Game Development Community

String: Starts with?

by Ricky Taylor · in Torque Game Builder · 03/24/2006 (8:04 am) · 2 replies

How do I check if a string starts with something?

Or even check individual characters of a string? (I only need first letter...)

#1
03/24/2006 (8:18 am)
GetSubStr( %string, start, end ) will extract a piece of a string for you.

For your case you would use:
%firstLetter = getSubStr( %string, 0, 1 );
#2
03/24/2006 (1:48 pm)
Hmm, I hadn't thought of that, despite I was already using substr in the same file. =P

Thanks.