I need to remove all blank lines.
I have tried this
Code: Select all
FileRead,Var,Testing.ahk
Loop
{
StringReplace, Var, Var, `r`n`r`n, `r`n, UseErrorLevel
if ErrorLevel = 0 ; No more replacements needed.
break
}
both leave blank lines.
Also, putting the text in a var then attempting to remove the blank lines does not work.
Code: Select all
var =
(
The Egyptian pyramids are ancient pyramid-shaped masonry structures located in Egypt.
There are 138 pyramids discovered in Egypt as of 2008.[1][2] Most were built as tombs for the country's Pharaohs and their consorts during the Old and Middle Kingdom periods.[3][4][5]
The earliest known Egyptian pyramids are found at Saqqara, northwest of Memphis. The earliest among these is the Pyramid of Djoser (constructed 2630 BC–2611 BC) which was built during the third dynasty. This pyramid and its surrounding complex were designed by the architect Imhotep, and are generally considered to be the world's oldest monumental structures constructed of dressed masonry.[6] The estimate of the number of workers to build the pyramids range from a few thousand, twenty thousand, and up to 100,000
The most famous Egyptian pyramids are those found at Giza, on the outskirts of Cairo. Several of the Giza pyramids are counted among the largest structures ever built.[9] The Pyramid of Khufu at Giza is the largest Egyptian pyramid. It is the only one of the Seven Wonders of the Ancient World still in existence.
By the time of the early dynastic period of Egyptian history, those with sufficient means were buried in bench-like structures known as mastabas.[10][11]
The second historically documented Egyptian pyramid is attributed to the architect Imhotep, who planned what Egyptologists believe to be a tomb for the pharaoh Djoser. Imhotep is credited with being the first to conceive the notion of stacking mastabas on top of each other – creating an edifice composed of a number of "steps" that decreased in size towards its apex. The result was the Step Pyramid of Djoser – which was designed to serve as a gigantic stairway by which the soul of the deceased pharaoh could ascend to the heavens. Such was the importance of Imhotep's achievement that he was deified by later Egyptians
)
Loop
{
StringReplace, Var, Var, `r`n`r`n, `r`n, UseErrorLevel
if ErrorLevel = 0 ; No more replacements needed.
break
}
MsgBox % var
Code: Select all
var =
(
The Egyptian pyramids are ancient pyramid-shaped masonry structures located in Egypt.
There are 138 pyramids discovered in Egypt as of 2008.[1][2] Most were built as tombs for the country's Pharaohs and their consorts during the Old and Middle Kingdom periods.[3][4][5]
The earliest known Egyptian pyramids are found at Saqqara, northwest of Memphis. The earliest among these is the Pyramid of Djoser (constructed 2630 BC–2611 BC) which was built during the third dynasty. This pyramid and its surrounding complex were designed by the architect Imhotep, and are generally considered to be the world's oldest monumental structures constructed of dressed masonry.[6] The estimate of the number of workers to build the pyramids range from a few thousand, twenty thousand, and up to 100,000
The most famous Egyptian pyramids are those found at Giza, on the outskirts of Cairo. Several of the Giza pyramids are counted among the largest structures ever built.[9] The Pyramid of Khufu at Giza is the largest Egyptian pyramid. It is the only one of the Seven Wonders of the Ancient World still in existence.
By the time of the early dynastic period of Egyptian history, those with sufficient means were buried in bench-like structures known as mastabas.[10][11]
The second historically documented Egyptian pyramid is attributed to the architect Imhotep, who planned what Egyptologists believe to be a tomb for the pharaoh Djoser. Imhotep is credited with being the first to conceive the notion of stacking mastabas on top of each other – creating an edifice composed of a number of "steps" that decreased in size towards its apex. The result was the Step Pyramid of Djoser – which was designed to serve as a gigantic stairway by which the soul of the deceased pharaoh could ascend to the heavens. Such was the importance of Imhotep's achievement that he was deified by later Egyptians
)
Loop, Parse, Var,`n,
{
if A_LoopField <>
var2 := (var2 "`n" A_loopfield )
}
MsgBox % var2
Anyone have any suggestions on how to remove all blank lines on large variables very fast.
thanks
DataLife