Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove empty lines
#1
In the following code, using the replacerx function always takes effect, but using the findreplace function sometimes does not take effect.
I want to use the findreplace function because it has lower resource consumption.

Macro Macro17
Code:
Copy      Help
out

_s=
;Node,ReleaseDate,SMBIOSBIOSVersion
;
;DESKTOP-3URCFPT,20131216000000.000000+000,F1

_s.trim; _s.findreplace("[][]", "[]") ;;Sometimes does not take effect
;_s.replacerx("\r\n?\r\n" "[]") ;;Always takes effect
out _s
#2
The following code always works. Is there a more concise way to write it?  Huh

The cause of issue #1 is that, in some cases, the line break is \r instead of \r\n.
 
Code:
Copy      Help
_s=
;Node,ReleaseDate,SMBIOSBIOSVersion
;
;Node,ReleaseDate,SMBIOSBIOSVersion
;
;DESKTOP-3URCFPT,20131216000000.000000+000,F1

str b=
;
;
;
_s.trim; _s.findreplace(b, "[]")

The problem is solved, but there might be a better way.  Smile

Code:
Copy      Help
_s.findreplace("[13][10][13][10]", "[]")
_s.findreplace("[13][13][10]", "[]")


Forum Jump:


Users browsing this thread: 1 Guest(s)