Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 6 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty: World at War
Category: CoDWW Scripting
Scripting and coding with Call of Duty: World at War.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: working with strings?
felico
General Member
Since: Mar 13, 2009
Posts: 11
Last: Aug 30, 2009
[view latest posts]
Level 1
Category: CoDWW Scripting
Posted: Wednesday, May. 27, 2009 07:40 pm
Hey guys!

I'd like to do some basic string handling in my .gsc, something like getting the length of a string or cutting it into pieces and stuff like that...

Anybody knows how to do it? Or isn't there implemented something like that?
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Wednesday, May. 27, 2009 07:51 pm
I dont know what you mean about getting the length of a string, but WaW's script language has several built-in string funtions, including getting a sub string:

GetSubStr( , , )

Returns the substring of characters >= and < . is optional.

IsSubStr( , )

Returns true/false if is a substring of . Case sensitive.

StrTok( , )

Tokenizes by the delimiters . Returns the array of string tokens.

ToLower( )

Converts to a lower case string which is returned.

Going back to the question of getting the length of a string, I suppose that if once the string is tokenized, you could get each token and calculate a strings length based on the number of tokens:

Code:
getMax( a, b, c, d )
{
	if( a > b )
		ab = a;
	else
		ab = b;
	if( c > d )
		cd = c;
	else
		cd = d;
	if( ab > cd )
		m = ab;
	else
		m = cd;
	return m;
}


edited on May. 27, 2009 03:56 pm by DemonSeed
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoDWW Scripting
Posted: Wednesday, May. 27, 2009 08:04 pm
I'm pretty sure you just use string.size as it's handled the same way an array is.

yep just tested

edited on May. 27, 2009 04:07 pm by NovemberDobby
Share |
felico
General Member
Since: Mar 13, 2009
Posts: 11
Last: Aug 30, 2009
[view latest posts]
Level 1
Category: CoDWW Scripting
Posted: Thursday, May. 28, 2009 03:30 pm
Thank you verrrry much guys. Thats exactly what i wanted to know, but i wasn't able to find it somewhere [biggrin]


Didnt know that a string is theated like a array, so string.size would work, but anyway...

T H A N K S !! [thumbs_up]
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty: World at War : CoDWW Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»