Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ctype_alpha(3) [php man page]

CTYPE_ALPHA(3)								 1							    CTYPE_ALPHA(3)

ctype_alpha - Check for alphabetic character(s)

SYNOPSIS
bool ctype_alpha (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are alphabetic. In the standard C locale letters are just [A-Za-z] and ctype_alpha(3) is equivalent to (ctype_upper($text) || ctype_lower($text)) if $text is just a single character, but other languages have letters that are considered neither upper nor lower case. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is a letter from the current locale, FALSE otherwise. EXAMPLES
Example #1 A ctype_alpha(3) example (using the default locale) <?php $strings = array('KjgWZC', 'arf12'); foreach ($strings as $testcase) { if (ctype_alpha($testcase)) { echo "The string $testcase consists of all letters. "; } else { echo "The string $testcase does not consist of all letters. "; } } ?> The above example will output: The string KjgWZC consists of all letters. The string arf12 does not consist of all letters. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_upper(3), ctype_lower(3), setlocale(3). PHP Documentation Group CTYPE_ALPHA(3)

Check Out this Related Man Page

CTYPE_PUNCT(3)								 1							    CTYPE_PUNCT(3)

ctype_punct - Check for any printable character which is not whitespace or an alphanumeric character

SYNOPSIS
bool ctype_punct (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are punctuation character. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is printable, but neither letter, digit or blank, FALSE otherwise. EXAMPLES
Example #1 A ctype_punct(3) example <?php $strings = array('ABasdk!@!$#', '!@ # $', '*&$()'); foreach ($strings as $testcase) { if (ctype_punct($testcase)) { echo "The string $testcase consists of all punctuation. "; } else { echo "The string $testcase does not consist of all punctuation. "; } } ?> The above example will output: The string ABasdk!@!$# does not consist of all punctuation. The string !@ # $ does not consist of all punctuation. The string *&$() consists of all punctuation. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_cntrl(3), ctype_graph(3). PHP Documentation Group CTYPE_PUNCT(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Split text file by pages

Hello! Firts of all, I'm sorry for my English. My problem: I have text file with few Form Feed symbols (FF, ASCII code =12) inside (for example - some report, consists of some pages for printing). I want to split this text by pages - each page (until FF symbol) in single file. I... (2 Replies)
Discussion started by: ranri
2 Replies

2. UNIX for Dummies Questions & Answers

wc -c

Hi, When I use wc -c : echo "word" |wc -c 5 The number is number of letters +1 I don't understand... Where is the probleme? I am on AIX but on HP, it the same probleme. (5 Replies)
Discussion started by: Castelior
5 Replies

3. Shell Programming and Scripting

transposing letters

Hi, I've written a shell function in bash that reads letters into an array, then outputs them in one column with: for n in "${array}"; do echo $n done I was wondering if anyone knew how i would transpose the letters that are output by the for loop. Right now my output is: aabbcc... (4 Replies)
Discussion started by: myscsa2004
4 Replies

4. Shell Programming and Scripting

How can I find the 3 first letters from the name file

Hello, I have a name file in Unix for example : ABC_TODAYFirst.001 and I want just capture or display the 3 first letters so : ABC. I tried with cut -c,1-3 and the name but it displays the 3 first letters of all lines. Can you help , Thanks a lot (8 Replies)
Discussion started by: steiner
8 Replies

5. Shell Programming and Scripting

If condition is -lt than 5 letters trouble.

Hi, In an If condition, how can I specify if the variable are less than 5 letters, echo “error”. Something like this one: echo –n “Your name please: “ read name if ; then Echo “Your name must be at least 5 letters length” exit fi Thanks a lot… (6 Replies)
Discussion started by: TARFU
6 Replies

6. Shell Programming and Scripting

Checking if string contains integer

G'day guys, first post so be gentle. I need help with some code to work out if a variable (string) contains any integers. The valid variable (string) must contain only letters. Also need to be able to work out if a variable contains only integers. Any help greatly appreciated. (7 Replies)
Discussion started by: haz
7 Replies

7. Shell Programming and Scripting

Parsing out the logs and generating report

My file will contain following(log.txt): start testcase: config loading ...... error XXXX ..... end testcase: config loading, result failed start testcase: ping check ..... error ZZZZZ ..... error AAAAA end testcase: Ping check, result failed I am expecting below output. ... (4 Replies)
Discussion started by: shellscripter
4 Replies

8. Homework & Coursework Questions

i get stuck with this shell script code

i get stuck here . Anyone could check my work? the user type a group of upper case letters at a time with 0 at the end. Find and display the first letter in alphabetic order. For example, input of F, G, K, S, U, G, D, Q, P , the result should be D Any invalid input character (eg. #, $, 3, a,... (5 Replies)
Discussion started by: sbcvn
5 Replies

9. Shell Programming and Scripting

deleting from one file and putting into another file

Hi I have a file that is organized like this. Basically the name is indicated by >name, then on a newline there is a sequence of letters. The letters are ASKL however sometimes there are non ASKL's like U's, G's or O's. Basically what I want to do is cut out the UUUU and record them. So heres... (4 Replies)
Discussion started by: gisele_l
4 Replies

10. Shell Programming and Scripting

Replace lower case letters with N

Hi, I have a string of letters that are upper and lower case. I would like to replace all the lowercase letters with N. Also, there are only 4 letters, so it may be easier to replace each lower case letter with N. Either way, I do not know know to do this. Example line ... (6 Replies)
Discussion started by: mikey11415
6 Replies

11. Shell Programming and Scripting

Extended replacing of nonspecific strings in text files [beware complicated !]

Well, to make another post at this helpful forum :b::D: I recently tried something like this, I want to replace all those numberings/letters that are located between <string>file://localhost/var/mobile/Applications/ and /Documents/</string> numberings =---- replace with: first... (6 Replies)
Discussion started by: pasc
6 Replies

12. Programming

How to allocate memory to a string in C?

hi I want to take string as a input from user and the string is very very length. From the lengthy string i have to substring take first 16 letters, then next 8 letters,................... Please guide me how to write program to take lengthy string from user and sub string it. Thanks (4 Replies)
Discussion started by: atharalikhan
4 Replies

13. Homework & Coursework Questions

Alphabetical help.

1. The problem statement, all variables and given/known data: Find the first letter in alphabet from the input: Accept the input of a series of upper case alphabetic letters one at a time. The input ends with a 0. Find and display the first letter in alphabetic order. For example, input... (27 Replies)
Discussion started by: Ren_kun
27 Replies

14. Shell Programming and Scripting

Automate multiple commands

Hi, I am trying to count the number of times a string of letters occurs in a file for multiple unique strings of letters. Right now I can do this one at a time using the following code (in this example I am searching for the string "AAA"): echo AAA >> outfile.txt grep -c "AAA" -r... (4 Replies)
Discussion started by: gecko1
4 Replies

15. UNIX for Dummies Questions & Answers

Text manipulation

i want to generate a list line-by-line of normal characters using letters . for example : dnds gnos mgod pets jnfp etc... i want to use all letters with all the posibilities is there a script that can do this ? (3 Replies)
Discussion started by: suppliernr1
3 Replies