Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Need Script Help w/String Compare

I am a basic script writer and have not needed to use Java. I now have a need to find strings that are six characters (digits) long and begin with a "1". Using if VAR == "1....." doesn't work. Does anyone have a simple solution for this simple string compare? Do I need to use Java? Example please?

2 REPLIES
New Member

Re: Need Script Help w/String Compare

Found it! String methods under the If Step:

If String.StartsWith("1")

VIP Super Bronze

Re: Need Script Help w/String Compare

Yep.

You can check length with the .Length(6) value.

((variable.StartsWith("1")) && (variable.Length(6)))

142
Views
0
Helpful
2
Replies
CreatePlease to create content