Detailed Usage Instructions for Functions in
"clc_text.js"
List of Functions
Detailed Usage Instructions
Int CLC_FindCharacter(String_Text, Char_Target)
Input parameters:
- String_Text - String of text that you wish to search
in.
- Char_Target - Character that you are searching for in
the "String_Text."
Return parameter:
- Int - The index position of "Char_Target" in
"String_Text." If "Char_Target" cannot be found, this
return value will be -1.
Error messages:
- Invalid text string - Getting this error means that
there was no text string. Check and make sure that
String_Text exists and is a string of text.
- Invalid target - Getting this error means that there
was no target character to search for. Check and make sure
that Char_Target exists and is a character.
Additional notes:
- This function can be used in conjunction with splitText
to break a paragraph into sentences. The splitText function
is built into the Firefox JavaScript DOM and is available
as a member function for Text Nodes.
- To a paragraph into sentences, search for the '.'
character with CLC_FindCharacter. Use splitText on the
return value of CLC_FindCharacter + 1. This will break the
paragraph into one sentence that ends with a '.' and the
rest of the paragraph. Repeat this for the rest of the
paragraph until you are done. Of course, this method is
rather crude and can result in issues such as
misinterpreting abbreviations as the end of a sentence.
Therefore, you will probably want to do some additional
checking to determine if you really do want to use
splitText at that position or not.
string CLC_GetSelectedText()
Input parameters:
Return parameter:
- String - The string of text that has been selected by
the user.
Error messages:
Additional notes:
String CLC_GetTextAfterMarker(String_Text, Char_Marker)
Input parameters:
- String_Text - String that is to be cut.
- Char_Marker - Character that is used to be the
delimiter where the cut will occur.
Return parameter:
- String - The rest of the "String_Text" that occurs
after the first occurrence of the "Char_Marker"
Error messages:
Additional notes:
- If the "Char_Marker" appears in multiple places in the
"String_Text," the cut will occur after the very first
occurrence of "Char_Marker" only.
bool CLC_HasText(DOM-Obj_Target)
Input parameters:
- DOM-Obj_Target - DOM-Obj that is being checked for text
content.
Return parameter:
- bool - True if the DOM-Obj has text content; else
false.
Error messages:
Additional notes:
- If there is at least on speakable character in the
textContent of the DOM-Obj, the DOM-Obj will be considered
to have text content.
- Input elements are always treated as having text
content.
bool CLC_IsSpeakableChar(Char_Target)
Input parameters:
- Char_Target - Character that is being tested for
speakability.
Return parameter:
- Bool - true if "Char_Target" is speakable; else
false.
Error messages:
Additional notes:
- Speakability is evaluated by comparing "Char_Target"
against known unspeakable characters. If "Char_Target" is
not found in the list of known unspeakable characters, it
is considered to be speakable.
bool CLC_IsSpeakableString(String_Target)
Input parameters:
- String_Target - String that is being tested for
speakability.
Return parameter:
- Bool - true if "String_Target" is speakable; else
false.
Error messages:
Additional notes:
- Speakability is evaluated by seeing if any character
inside of String_Target is considered speakable by the
CLC_IsSpeakableChar function. If there is at least one such
speakable character, the string is considered
speakable.
bool CLC_IsUpper(Char_Target)
Input parameters:
- Char_Target - Character that is being tested for
whether or not it is uppercase.
Return parameter:
- Bool - true if "Char_Target" is uppercase; else
false.
Error messages:
Additional notes:
- Non-alphabet characters are considered to not be
uppercase and will return false.
bool CLC_StringIsAllNumber(String_Target)
Input parameters:
- String_Target - String that is being tested to see if
it only contains numbers.
Return parameter:
- Bool - true if "String_Target" is numeric; else
false.
Error messages:
Additional notes: