Sign in to follow this  
Followers 0
victor

Separate parts of the strings

4 posts in this topic

how do I separate part of the string

$var="12345|99"

how to separate or get 99 from $var ??

Thanks in advance

Share this post


Link to post
Share on other sites



hi,

i suggest using StringSplit(). This can split a part of a string using a 'delimiter'. This delimiter is a picked character.

example:

$var = StringSplit("12345|99", "|")
If Not $var[0] = 1 Then
 For $x=1 To $var[0]
  MsgBox(0, "", $var[$x])
 Next
EndIf

EXPLANATION:

The stringsplit command splits the string "12345|99" with the delimiter "|". The results (which is an array) is put into $var.

$var[0] ALWAYS shows how many elements are found. If $var[0] equals 1 means that NO occurences where found and the whole string is returned back to $var[1]. If there are more delimiters found it will be split into 1,2,3, etc. and the number of elements put into $var[0]

hope that helps :)

immense

Share this post


Link to post
Share on other sites

hi,

i suggest using StringSplit(). This can split a part of a string using a 'delimiter'. This delimiter is a picked character.

example:

$var = StringSplit("12345|99", "|")
If Not $var[0] = 1 Then
 For $x=1 To $var[0]
  MsgBox(0, "", $var[$x])
 Next
EndIf

EXPLANATION:

The stringsplit command splits the string "12345|99" with the delimiter "|". The results (which is an array) is put into $var.

$var[0] ALWAYS shows how many elements are found. If $var[0] equals 1 means that NO occurences where found and the whole string is returned back to $var[1]. If there are more delimiters found it will be split into 1,2,3, etc. and the number of elements put into $var[0]

hope that helps :)

immense

Thanks for the fast reply

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0