Jump to content

String Problem :(


 Share

Recommended Posts

ok, basically i have a file which contains information which looks like: 1|username|435m345nm435b345

Im attempting to get the "1", the very first character, except i cant just StringTrimRight because the "1" could go to 2 characters, such as "22" or "356", i basically have to cut it off and get the chracter(s) before the first |

If anybody could help it would be very appriciated!

this has mind boggled me :P

Link to comment
Share on other sites

...except i cant just StringTrimRight because the "1" could go to 2 characters, such as "22" or "356",...

$str = "1|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

$str = "22|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

$str = "356|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...