Director Help

char...of

Usage

-- Lingo syntax
textMemberExpression.char[whichCharacter]
char whichCharacter of fieldOrStringVariable
textMemberExpression.char[firstCharacter..lastCharacter]
char firstCharacter to lastCharacter of fieldOrStringVariable

Description

Keyword; identifies a character or a range of characters in a chunk expression. A chunk expression is any character, word, item, or line in any source of text (such as field cast members and variables) that holds a string.

  • An expression using whichCharacter identifies a specific character.
  • An expression using firstCharacter and lastCharacter identifies a range of characters.

The expressions must be integers that specify a character or range of characters in the chunk. Characters include letters, numbers, punctuation marks, spaces, and control characters such as Tab and Return.

You can test but not set the char...of keyword. Use the put...into command to modify the characters in a string.

Example

This statement displays the first character of the string $9.00:

//Lingo
put(("$9.00").char[1..1])
-- "$"

// Javascript
trace(("$9.00").substring(0,1))
-- "$"

This statement displays the entire string $9.00:

//Lingo
put(("$9.00").char[1..5])
-- "$9.00"

// Javascript
trace(("$9.00").substring(0))
-- "$9.00"

This statement changes the first five characters of the second word in the third line of a text cast member:

//Lingo
member("quiz").line[3].word[2].char[1..5] = "?????"

// Javascript
var s = member(1).getPropRef("line",3).getProp("word",2)
s=s.replace(s.substring(0),"????")
member(1).getPropRef("line",3).setProp("word",2,s)

See also

mouseMember, mouseItem, mouseLine, mouseWord