[jawsscripts] Re: Character Index in String?
- From: "David Farough" <David.Farough@xxxxxxxxxxxxx>
- To: <jawsscripts@xxxxxxxxxxxxx>
- Date: Thu, 22 Jan 2009 07:41:41 -0500
Hi Donald:
If you check out the StringContains function, you will see, that if the
string you are looking for is contained within the string to be
searched, that StringContains returns the position in the string where
the match of characters begins. While researching this I also found the
StringReplaceSubstrings. This one seems to do exactly what you want.
Here is the entry for this one.
Function: StringReplaceSubstrings
Description
For example, StringReplaceSubstrings("hello there everyone", "there",
"") would result in hello everyone.
Returns
Type: string
Description: the resultant string
Parameters
Param 1:
Type: string
Description: source string
Include: Required
Param 2:
Type: string
Description: the substring in source to replace.
Include: Required
Param 3:
Type: string
Description: the string to replace any occurances of above string with
(maybe null to remove occurances).
Include: Required
Version
This function is available in the following releases:
JAWS 6.00 and later
Magic 10.5 and later
David Farough
Application Accessibility Coordinator/coordonateur de l'accessibilité
Information Technology Services Directorate /
Direction des services d'information technologiques
Public Service Commission / Commission de la fonction publique
Email / Courriel: David.Farough@xxxxxxxxxxxxx
Tel. / Tél: (613) 992-2779
>>> "Donald Marang" <donald.marang@xxxxxxxxx> 10:06 pm Wednesday,
January 21, 2009 >>>
Hopefully, this is an easy question for you guys.I want to remove all
characters in a string after the occurrence of a certain character, lets
say ":", and including that character. I looked at the StringLeft and
StringContainsChars functions. To have these two functions work
together, the StringContainsChars would need to return the index where
the character was found rather than just a Boolean True or false. Are
there more appropriate functions or methods to accomplish this simple
task.
For instance I want to transform the string
"Menu:only available in To DVD mode"
to
"Menu"
Don Marang
__________
Visit and contribute to The JAWS Script Repository
http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
__________
Visit and contribute to The JAWS Script Repository http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
Other related posts: