Character/Number check

By StaticX__ on Oct 23, 2008

Hello, a simple command that finds characters or checks if there are numbers in the text.
Put it in the Remotes section.
Syntax:
/char [-cn] <character/number>
Returns the $chr() number of your entry.
-c : Enter a Character number ($chr(This-number)) and it returns the character
-n : Enter some text and it returns if there are numbers in the text or no.

EXAMPLES:

/char 1 returns "character found: $chr(49)"
/char -c 49 returns "character: 1"
/char -n abc returns "Numbers in the text: no"
but /char -n abc1 returns "Numbers in the text: yes"

alias char {
  unset %chrr
  unset %num_x
  if ($1 == -n) {
    if ((0 isin $2-) || (1 isin $2-) || (2 isin $2-) || (3 isin $2-) || (4 isin $2-) || (5 isin $2-) || (6 isin $2-) || (7 isin $2-) || (8 isin $2-) || (9 isin $2-)) { set %num_x yes }  
    else { set %num_x no }
    echo 4 -a Numbers in the text: %num_x
    halt
  }
  if ($1 == -c) {
    if ($2) { 
      if ($len($2) <= 3) { 
        if ($chr($2) == $null) { echo 4 no results found. | halt }
        if ((0 isin $2) || (1 isin $2) || (2 isin $2) || (3 isin $2) || (4 isin $2) || (5 isin $2) || (6 isin $2) || (7 isin $2) || (8 isin $2) || (9 isin $2)) {
          echo 4 character: $chr($2) 
        }
        else { echo 4 your entry must include numbers. }
      }
      else { echo 4 length must be 3 }
    }
    else { echo 4 please enter something. }
    halt
  }
  if ($len($1) == 1) {
    var %i = 1
    while (%i <= 200) {
      if ($chr(%i) == $1) { set %chrr $ $+ chr( $+ %i $+ ) }
      inc %i
    }
    if (%chrr) { echo 4 character found: %chrr }
    if (!%chrr) { echo 4 no character found }
  }
  else { echo 4 length must be 1 }
}

Comments

Sign in to comment.
guest598594   -  Oct 23, 2008
if ((0 isin $2-) || (1 isin $2-) || (2 isin $2-) || (3 isin $2-) || (4 isin $2-) || (5 isin $2-) || (6 isin $2-) || (7 isin $2-) || (8 isin $2-) || (9 isin $2-)) {

You could do

if ($regex($2-,/\d/)) {
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.