RE: stringContainsChars

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 18 Oct 2007 14:48:20 -0400

#1: Why would you want to do this?
 
#2: do not reinvent the wheel

#3: your answer did not include a string or a loop that goes over that
string

I don't see where you're coming from at all ... just use the existing
functions and combine or extend them if needed, but not willy nilly.

Am I missing something?

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
Tyler
Sent: Thursday, October 18, 2007 2:42 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: stringContainsChars

sina, you could check the char individually... I've done that. that's how I
wrote my isalpha func

Thanks,
Tyler Littlefield.
Vertigo head coder
"My programs don't have bugs, just randomly added features."
msn: tyler@xxxxxxxxxxxxx
email: tyler@xxxxxxxxxxxxx
aim: st8amnd2005
web: tysdomain.com
----- Original Message -----
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, October 18, 2007 11:43 AM
Subject: RE: stringContainsChars


> This is for jaws scripts, not for c
>
> Also, this will not work because of a myriad of reasons, but even in c, 
> this
> wouldn't be appropriate because a string, not a char, is being checked.
> Furthermore, even if this were c, the appropriate way to do this would be 
> to
> use the following from ctype.h.
>
> isalpha
>
> int isalpha(int c);
>
> The function returns nonzero if c is any of:
>
> a b c d e f g h i j k l m n o p q r s t u v w x y z
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
> or any other locale-specific alphabetic character.
>
> Also, there are a whole host of useful functions in ctype.h that make life
> easy
>
> isalnum
>
> int isalnum(int c);
>
> The function returns nonzero if c is any of:
>
> a b c d e f g h i j k l m n o p q r s t u v w x y z
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
> o 1 2 3 4 5 6 7 8 9
> or any other locale-specific alphabetic character.
>
> isalpha
>
> int isalpha(int c);
>
> The function returns nonzero if c is any of:
>
> a b c d e f g h i j k l m n o p q r s t u v w x y z
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
> or any other locale-specific alphabetic character.
>
> iscntrl
>
> int iscntrl(int c);
>
> The function returns nonzero if c is any of:
>
> BEL BS CR FF HT NL VT
> or any other implementation-defined control character.
>
> isdigit
>
> int isdigit(int c);
>
> The function returns nonzero if c is any of:
>
> 0 1 2 3 4 5 6 7 8 9
>
> isgraph
>
> int isgraph(int c);
>
> The function returns nonzero if c is any character for which either 
> isalnum
> or ispunct returns nonzero.
>
> islower
>
> int islower(int c);
>
> The function returns nonzero if c is any of:
>
> a b c d e f g h i j k l m n o p q r s t u v w x y z
> or any other locale-specific lowercase character.
>
> isprint
>
> int isprint(int c);
>
> The function returns nonzero if c is space or a character for which 
> isgraph
> returns nonzero.
>
> ispunct
>
> int ispunct(int c);
>
> The function returns nonzero if c is any of:
>
> ! " # % & ' ( ) ; <
> = > ? [ \ ] * + , -
> . / : ^ _ { | } ~
> or any other implementation-defined punctuation character.
>
> isspace
>
> int isspace(int c);
>
> The function returns nonzero if c is any of:
>
> CR FF HT NL VT space
> or any other locale-specific space character.
>
> isupper
>
> int isupper(int c);
>
> The function returns nonzero if c is any of:
>
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
> or any other locale-specific uppercase character.
>
> isxdigit
>
> int isxdigit(int c);
>
> The function returns nonzero if c is any of:
>
> 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
>
> tolower
>
> int tolower(int c);
>
> The function returns the corresponding lowercase letter if one exists and 
> if
> isupper(c); otherwise, it returns c.
>
> toupper
>
> int toupper(int c);
>
> The function returns the corresponding uppercase letter if one exists and 
> if
> islower(c); otherwise, it returns c.
>
> Some more difficult ways to do this, would be by using the following from
> string.h
>
> strspn
>
> size_t strspn(const char *s1, const char *s2);
>
> The function searches for the first element s1[i] in the string s1 that
> equals none of the elements of the string s2 and returns i. It considers 
> the
> terminating null character as part of the string s1 only.
>
> Using strtok would be overkill, but here is information on that as well.
>
> strtok
>
> char *strtok(char *s1, const char *s2);
>
> If s1 is not a null pointer, the function begins a search of the string 
> s1.
> Otherwise, it begins a search of the string whose address was last stored 
> in
> an internal static-duration object on an earlier call to the function, as
> described below. The search proceeds as follows:
>
> The function searches the string for begin, the address of the first 
> element
> that equals none of the elements of the string s2 (a set of token
> separators). It considers the terminating null character as part of the
> search string only.
>
> If the search does not find an element, the function stores the address of
> the terminating null character in the internal static-duration object (so
> that a subsequent search beginning with that address will fail) and 
> returns
> a null pointer. Otherwise, the function searches from begin for end, the
> address of the first element that equals any one of the elements of the
> string s2. It again considers the terminating null character as part of 
> the
> search string only.
>
> If the search does not find an element, the function stores the address of
> the terminating null character in the internal static-duration object.
> Otherwise, it stores a null character in the element whose address is end.
> Then it stores the address of the next element after end in the internal
> static-duration object (so that a subsequent search beginning with that
> address will continue with the remaining elements of the string) and 
> returns
> begin.
>
> Take care,
> Sina
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
> Tyler
> Sent: Thursday, October 18, 2007 12:11 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: stringContainsChars
>
> if you're checking for alpha chars. you can do something like:
> if (char >= asc(a) && char <= asc(z) || char >= asc(A) && char <= asc(Z))
> it'll see if it's an alpha char if you compare it's ascii values
>
> Thanks,
> Tyler Littlefield.
> Vertigo head coder
> "My programs don't have bugs, just randomly added features."
> msn: tyler@xxxxxxxxxxxxx
> email: tyler@xxxxxxxxxxxxx
> aim: st8amnd2005
> web: tysdomain.com
> ----- Original Message -----
> From: "Jackie McBride" <abletec@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Thursday, October 18, 2007 10:02 AM
> Subject: Re: stringContainsChars
>
>
>> You're gonna need 2 clarify that for me a little, Ty--I'm not sure
>> what you're saying here.
>>
>> On 10/18/07, Littlefield, Tyler <tyler@xxxxxxxxxxxxx> wrote:
>>> Hello jacky,
>>> why not search on a range of ascii numbers?
>>> Thanks,
>>> Tyler Littlefield.
>>> Vertigo head coder
>>> "My programs don't have bugs, just randomly added features."
>>> msn: tyler@xxxxxxxxxxxxx
>>> email: tyler@xxxxxxxxxxxxx
>>> aim: st8amnd2005
>>> web: tysdomain.com
>>> ----- Original Message -----
>>> From: "Jackie McBride" <abletec@xxxxxxxxx>
>>> To: <programmingblind@xxxxxxxxxxxxx>
>>> Sent: Thursday, October 18, 2007 8:30 AM
>>> Subject: Re: stringContainsChars
>>>
>>>
>>> > See, Martin, I have this *major* problem--I'm too bleepin *lazy* to do
>>> > all that typing!  I do as little scripting/programming as possible due
>>> > to that l word also.  But sometimes u just gotta, I guess.
>>> >
>>> > On 10/17/07, Martin Slack <m.g.slack@xxxxxxxxxxxx> wrote:
>>> >> Your guess is as good as mine Jackie, but don't forget that you could
>>> >> probably define some string constants like
>>> >>
>>> >> Const
>>> >> alpha = "abcdefghijklmnopqrstuvwxyz"
>>> >>
>>> >> and use that as the appropriate parameter.
>>> >>
>>> >>   Caveat Emptor,
>>> >>
>>> >> Martin
>>> >>
>>> >>
>>> >> ----- Original Message -----
>>> >> From: "Jackie McBride" <abletec@xxxxxxxxx>
>>> >> To: <programmingblind@xxxxxxxxxxxxx>
>>> >> Sent: Thursday, October 18, 2007 1:43 AM
>>> >> Subject: Re: stringContainsChars
>>> >>
>>> >>
>>> >> > Thanks, Martin--I actualy figured it out--they sure don't make it
>>> >> > easy
>>> >> > by letting u search on such things as a-z, etc.  I was hoping 
>>> >> > things
>>> >> > could be a bit easier, but,
>>> >> > no!!!!  Why should *that* happen?  &, I agree w/Brian when he said
>>> >> > in
>>> >> > a later post that FS's docs leave a great deal to be desired.
>>> >> >
>>> >> > On 10/17/07, Martin Slack <m.g.slack@xxxxxxxxxxxx> wrote:
>>> >> >> Hi Jackie,
>>> >> >>
>>> >> >>   Both parameters are simple strings.  Parameter one is the string
>>> >> >> to
>>> >> >> search, and parameter two is a string containing all the 
>>> >> >> characters
>>> >> >> that
>>> >> >> you
>>> >> >> want to search for.  If any one of those characters is in the 
>>> >> >> other
>>> >> >> string,
>>> >> >> then success is returned.
>>> >> >>
>>> >> >>   hth
>>> >> >>
>>> >> >> Martin
>>> >> >>
>>> >> >>
>>> >> >> ----- Original Message -----
>>> >> >> From: "Jackie McBride" <abletec@xxxxxxxxx>
>>> >> >> To: <programmingblind@xxxxxxxxxxxxx>
>>> >> >> Sent: Wednesday, October 17, 2007 4:00 PM
>>> >> >> Subject: stringContainsChars
>>> >> >>
>>> >> >>
>>> >> >> > Just comin' out real quick 2 ask if any1 knows the syntax of the
>>> >> >> > StringContainsChars jaws scripting function--specifically, how
>>> >> >> > does
>>> >> >> > 1
>>> >> >> > format the list of characters?  I read the FSDN but it doesn't
>>> >> >> > mention
>>> >> >> > that.
>>> >> >> >
>>> >> >> > --
>>> >> >> > Jackie McBride
>>> >> >> > Please sign the Yahoo Accessibility petition at:
>>> >> >> > <http://www.petitiononline.com/yabvipma/petition.html>
>>> >> >> > & Check out my homepage at:
>>> >> >> > www.abletec.serverheaven.net
>>> >> >> > __________
>>> >> >> > View the list's information and change your settings at
>>> >> >> > //www.freelists.org/list/programmingblind
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >> __________
>>> >> >> View the list's information and change your settings at
>>> >> >> //www.freelists.org/list/programmingblind
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> > --
>>> >> > Jackie McBride
>>> >> > Please sign the Yahoo Accessibility petition at:
>>> >> > <http://www.petitiononline.com/yabvipma/petition.html>
>>> >> > & Check out my homepage at:
>>> >> > www.abletec.serverheaven.net
>>> >> > __________
>>> >> > View the list's information and change your settings at
>>> >> > //www.freelists.org/list/programmingblind
>>> >> >
>>> >> >
>>> >>
>>> >> __________
>>> >> View the list's information and change your settings at
>>> >> //www.freelists.org/list/programmingblind
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Jackie McBride
>>> > Please sign the Yahoo Accessibility petition at:
>>> > <http://www.petitiononline.com/yabvipma/petition.html>
>>> > & Check out my homepage at:
>>> > www.abletec.serverheaven.net
>>> > __________
>>> > View the list's information and change your settings at
>>> > //www.freelists.org/list/programmingblind
>>> >
>>> >
>>> >
>>> > --
>>> > No virus found in this incoming message.
>>> > Checked by AVG Free Edition.
>>> > Version: 7.5.488 / Virus Database: 269.15.0/1077 - Release Date:
>>> > 10/18/2007 9:54 AM
>>> >
>>> >
>>>
>>> __________
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/programmingblind
>>>
>>>
>>
>>
>> -- 
>> Jackie McBride
>> Please sign the Yahoo Accessibility petition at:
>> <http://www.petitiononline.com/yabvipma/petition.html>
>> & Check out my homepage at:
>> www.abletec.serverheaven.net
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.488 / Virus Database: 269.15.0/1077 - Release Date:
>> 10/18/2007 9:54 AM
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.15.0/1077 - Release Date: 
> 10/18/2007 9:54 AM
> 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: