Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple lines of text are split and assigned to multiple variables
#1
Hi,

I want to split multiple lines of text and assign values to multiple variables
Blank lines inside are to be reserved

The symbol that splits the row is -------------------------------

The first part is assigned to the variable s1
The second part is assigned to the variable s2
The third part assigns the value to the variable s3

Thanks in advance for any advice and help
david

Macro Macro2
Code:
Copy      Help
_s=
;abc
;
;abcdef
;
;
;-------------------------------
;ghi
;
;ghij
;
;
;ghijk
;-------------------------------
;lmn
;
;lmno
;
;pq

str s1 s2 s3

Powershell Equivalent codes:
 
Code:
Copy      Help
 
$s = @'
abc

abcdef


-------------------------------
ghi

ghij


ghijk
'@ -split '-------------------------------'

$s1 = $s[0]
$s1

$s2 = $s[1]
$s2


Messages In This Thread
Multiple lines of text are split and assigned to multiple variables - by Davider - 08-30-2022, 10:21 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)