Check the string only Alpha characters
Is there a function in ColdFusion that will check that a string of alpha only characters (not digital or for example &, $, etc.)? I try to avoid creating a string of alpha characters or all all nonalphanumeric characters to loop on and the text is authoritative.
Which could easily be done with a regular expression using REFIND() function search.
Something like that on the top of my head and untested example. REFIND("[^A-Za-z]",yourStringVar). If that returns true then we characters other characters then alpha in the chain.
Tags: ColdFusion
Similar Questions
-
How let labview to check the string is in Scientific Notation.
Hey all,.
I want to labview to convert a worksheet string in a table. It's easy using the tool 'chain of worksheet to the table '. The only problem I have is that I get the string from a RS232 device and the critical moment arrives.
Example:
If I read the data from the buffer it gives me:
1.50337800E + 00 + 1.70316300E + 00 for both channels, it is converted and accepted
If there is a slight delay, I get:
+ 1.50337800E + 00 + 1.70316
It is also accepted because + 1.70316 is also recognized as a number.
How can program labview to check each number he reads is according to Scientific Notation?
Thank you
This regex seems to work for me, for all cases, I've tried:
[+/-]\d+\.\d+[Ee][+/-]\d+
Note that it is very restrictive and only follows the shape of ±n.nnnE±mm
-
Select leading only alpha characters
Hi all
How can I select just the main alpha characters in an alphanumeric string? Is it possible to do without regular expressions?
For example:
U14385
T7884
DA0036
AVA8801J24
woould return:
U
T
DA
AVA
Similarly, I would need to return to the rear of the channel as well:
14385
7884
0036
8801J24
Thank you
John
SQL >-generation date sample:
SQL > with t (col) as)
2 Select "U14385" of all the double union
3 select "T7884" of all the double union
4 Select "DA0036" of all the double union
5. Select 'AVA8801J24' from dual
6)
7 --
8 - the actual query:
9 --
10. Select collar
11, substr (col
12 , 1
13, instr (translate (col, "0123456789", "0000000000 '), '0')-1
14 )
15, substr (col
16, instr (translate (col, "0123456789", "0000000000 '), '0')
17 )
18 t;
SUBSTR (SUBSTR NECK (NECK OF THE CERVIX
---------- ---------- ----------
U14385 U 14385
T7884 T 7884
DA0036 DA 0036
AVA8801J24 AVA 8801J24
4 selected lines.
-
Hello
How can I check if the string has been inserted is in English langugue or not?
I want to trigger the error if the value inserted is not in English
Could you please help me?
Kind regards
YB859774 wrote:
How can I check if the string is not English?You can not.
-
Hello
In my application, TestStand receives a response from a DLL I give the floor. This DLL can return either a numeric value (casting in a string), as "120" or some sunk in a text string, as a "MISTAKE." I would like to make the test step fails, if the return string is NOT a number.
Someone at - it a clues on how to do it? I tried something like an IsNumeric function, but couldn't find one.
Jeroen
Hello
You can use the Val (string,
) function in an expression to convert your value chain. Check using this function. -
Read the string between two characters
I have an xml file that is saved to a text file, and the XML was not in Labview. I want to be able to read each line of the text file and display the text that is between ' > '.
I'll leave the text as an attachment file.
This could give you some tips, but you have to play with it to get properly what you want. I'm not really good at manipulating strings and not too familiar with regular expressions, I'm sorry...
-
Check the string value when using xdoxslt
Hello
I'm new to the BEEP and will have questions in writing this simple code for a model RTF. In plain language, that's what I want to do:
If (instr(FirstName,'concern',0) > 0 and instr(LastName,'concern',0) > 0 and instr(MiddleName,'concern',0) > 0) then the VNAME variable value "
on the other
If (instr(LastName,'1-',0) > 0), then set VNAME variable FirstName
on the other
the value of VNAME variable FirstName + "" + name
Finally... show the VNAME variable
===========
I wrote it, but it doesn't work:
declared variable... Initialize it to x.
<? xdoxslt:set_variable($_XDOCTX,_'v_RTPMName',_'x')? >
String value of control-> - error.
<? If: (xdoxslt:Instr (lower(coFirstName|| coMiddleName || coLastName), "abuses", 0) > 0)? >
<? xdoxslt:set_variable($_XDOCTX,_'v_RTPMName',_'')? >
<? end if? >
write the variable
<? xdoxslt:get_variable($_XDOCTX,_'v_RTPMName')? >
Thanks for the help!
For a quick overview,.
InStr is belong to the xdofx family, must be used in this way instead of xdoxslt:Instr()
For example: If condition 1 0 otherwise true back
0 then 1 or 0 end if? >
-
I would like to disable the download only history
Hello
I would like to disable the download only history, I tried the option 'clear history when firefox closes' check the download only history, but it did not work. the download window is clear, but it's all there in the download history.
is there a way to disable the download only, history without touching the others intact?Thank you
Rgds
JPThe download history is stored as part of the normal history (visited sites/links) and a special annotation identifies it as a download item in the history.
If you can not separate the two more.
Note that the classic Download Manager stores its data in a different file, you will need to check both if you have set on remember downloads.You can set the browser.download.useToolkitUI pref Boolean true on the topic: config page to restore the old window Download Manager and check all the settings download appear in "tools > Options > general.
The pref browser.download.manager.retention has no effect with the new download manager and is forced to manual (2).
-
The attached VI allows me to convert a single ASCII character to the spell.
If I have a string of ASCII characters, I can convert them to break the string into individual characters and converting each individually then forming a chain again. Is there an easy way to convert a hexadecimal ASCII without analysis string?
For example: CN1003001A (string ASCII) must be equal to 434E3130303330303141 (string hex).
Thank you
String to byte array, number in hexadecimal string Concantanate String.
-
JavaScript to check the value of the Textbox
Hi all
I have a few simple javascript in the header of my page to check the value of an element... There is no errors in Firebug, but the alert window is also never coming.
Thanks for any help.if ($v('P2_ITEM') == 'VALUE1') { alert('VALUE1'); } if ($v('P2_ITEM') == 'VALUE2') { alert('VALUE2'); } if ($v('P2_ITEM') == 'VALUE2') { alert('VALUE2'); }
Use double quotes in JS to check the string values:
function test_choice() { if ($x('P2_ITEM') == "Test1") { alert("Test1"); } if ($x('P2_ITEM') == "Test2") { alert("Test2"); } if ($x('P2_ITEM') == "Test3") { alert("Test3"); } }
-
How to check the columns updated condition in after triggers
Hello
I create after the update trigger,
-------------------------------------------------------------
create or replace
TRIGGER 'TR_U_PAYING_MEMBER '.
AFTER UPDATE
ON PAYING_MEMBER
FOR EACH LINE
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
IF ***(:new.active_member_status) and (: old.active_member_status) is not null THEN
Begin
Insert in the table of the newspaper...
commit;
End
End
---------------------------------------------------------------
How can I check the condition only this update of column. (********)
I used "update (: new.active_member_status) ' but it does not work.NVL IF (: New.ColName, ' the NVL value)! = NVL (: old.) Column name, 'any value NVL') THEN...
is what you are looking for.
-
How to check the value of a string is numeric, alphanumeric or characters?
Hi all
I have a task to validate an employee ID, assume that the employee Id is E121212. Now according to the validation rule, I need to check "the first letter of the employee Id is a character and rest are numbers." How can I do this? Please answer.
Thanks and greetings
Marie LaurenceHello
You can opt for regexp_like in this case. See the code below
with data as ( select 'E121212' s from dual union all select '121212' from dual union all select 'EE121212' from dual union all select 'EE1212EE' from dual union all select 'É121212' s from dual ) select * from data where regexp_like (s, '^[A-Z]\d+$') S E121212
^ [A-Z] means that, at the beginnign (^), should be only between A - Z characters, uppercase. If you want to add lowercase letters, you can easily replace it [A-Za-z]. \d is a symbol for the numbers and + means it must complete at least one or more of her. $ means the end, so he stayed there until the end but nothig figures.
If yoou want characters as allowed, you can change the character class to [: alpha:]
select * from data where regexp_like (s, '^[[:alpha:]]\d+$') S E121212 É121212
concerning
Published by: chris227 on 26.07.2012 00:53
fix -
check if a string contains only some characters
I'm working on a java program that converts the Roman numbers. The user enters a string, and I need to check to make sure that it contains MDCLXVI and if he doesn't I will get them the input again string. I thought I'd do a while loop but I'm not sure if it's the smart way to make or the syntax to perform the check.
Here was a thought on the control with a while loop, but I've never used it before and maybe build evil.
My Code is as follows:while (!Pattern.matches("MDCLXVI", firstRoman)) { System.out.print("Not a valid Roman Number please try again"); firstRoman = firstRoman.toUpperCase(); }
Once they enter in the it, I want to check to make sure that it has characters MDCLXVI and if it contains any other characters then I will provide a new object Scanner keyboard to try again and if it fails again, it will go to the option to try again until they put in a string that contains only the characters above. I don't know where to go here to get the while loop has worked. New to Java and I got my program work properly when I put good known numbers of novel, but I want to take incorrect entries.// Ask for user to input firstRoman Number System.out.print("Enter your first Roman Number:"); // add the Roman Number to the String variable firstRoman = keyboard.nextLine(); firstRoman = firstRoman.toUpperCase();
Any help would be appreciated.
Thank you
Wally
I put the code for my main program and my class below just in case. I have already met the requirements of the teacher if the project is done, I'm just trying to improve.
CLASS:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package myname.project.pkg6; import java.util.Scanner; import java.util.regex.Pattern; /** * * @author wsteadma */ public class mynameProject6 { /** * @param args the command line arguments */ public static void main(String[] args) { // Used for testing String firstRoman; String secondRoman; Scanner keyboard = new Scanner(System.in); // Ask for user to input firstRoman Number System.out.print("Enter your first Roman Number:"); // add the Roman Number to the String variable firstRoman = keyboard.nextLine(); firstRoman = firstRoman.toUpperCase(); // Ask for user to input secondRoman Number System.out.print("Enter your second Roman Number:"); // add the Roman Number to the String variable secondRoman = keyboard.nextLine(); // Add the name input into the name variable secondRoman = secondRoman.toUpperCase(); //Creating first instance of Roman Numbers class Roman firstNumber = new Roman(firstRoman); Roman secondNumber = new Roman(secondRoman); System.out.println("Printout of the created roman numbers"); //Prints out the Roman Number firstNumber.printRoman(); secondNumber.printRoman(); // Convert Roman to Decimal firstNumber.setDecimal(firstRoman); secondNumber.setDecimal(secondRoman); System.out.println("Viewing the Decimal values for the two defined instances"); //Prints decimal Numbers firstNumber.printDecimal(); secondNumber.printDecimal(); System.out.println("Adding the Roman Numbers and returning new Roman value"); Roman romanAdd; romanAdd = firstNumber.addRoman(secondNumber); romanAdd.printRoman(); System.out.println("Subtracting the Roman Numbers and return new Roman value"); Roman romanSub; romanSub = firstNumber.subRoman(secondNumber); romanSub.printRoman(); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package myname.project.pkg6; /** * * @author wsteadma */ public class Roman { private String romNumber; private int decNumber; public Roman(String rNumber) { romNumber = rNumber; } public String getRoman() { return romNumber; } public int getDecimal() { return decNumber; } public void printRoman() { System.out.println("The Roman Number is " + romNumber); } public void printDecimal() { System.out.println("The Decimal Number is " + decNumber); } // Converts a roman number string into a decimal value public int setDecimal(String romNum) { int charValue = 0; char[] characters = new char[romNum.length()]; //System.out.println("romNum length is " + romNum.length()); for (int counter = 0; counter < romNum.length(); counter++) { characters[counter] = romNum.charAt(counter); //System.out.println(characters[counter]); } for (int sCounter = 0; sCounter < romNum.length(); sCounter++) { if (characters[sCounter] == 'M' || characters[sCounter] == 'm') { charValue += 1000; } else if (characters[sCounter] == 'D' || characters[sCounter] == 'd') { charValue += 500; } else if (characters[sCounter] == 'C' || characters[sCounter] == 'c') { charValue += 100; } else if (characters[sCounter] == 'L' || characters[sCounter] == 'l') { charValue += 50; } else if (characters[sCounter] == 'X' || characters[sCounter] == 'x') { charValue += 10; } else if (characters[sCounter] == 'V' || characters[sCounter] == 'v') { charValue += 5; } else if (characters[sCounter] == 'I' || characters[sCounter] == 'i') { charValue += 1; } } decNumber = charValue; return charValue; } // Converts a decomal number to a roman number public String setDec2Roman(int decNum) { String newRoman = ""; while (decNum >= 1000) { newRoman += "M"; decNum -= 1000; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 500) { newRoman += "D"; decNum -= 500; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 100) { newRoman += "C"; decNum -= 100; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 50) { newRoman += "L"; decNum -= 50; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 10) { newRoman += "X"; decNum -= 10; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 5) { newRoman += "V"; decNum -= 5; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum > 0) { newRoman += "I"; decNum -= 1; //System.out.println(decNum); //System.out.println(newRoman); } return newRoman; } public Roman addRoman(Roman newRom) { int totRom = newRom.setDecimal(newRom.romNumber) + decNumber; romNumber = newRom.setDec2Roman(totRom); return new Roman(romNumber); } public Roman subRoman(Roman subRom) { int totRom = decNumber - subRom.setDecimal(subRom.romNumber); romNumber = subRom.setDec2Roman(totRom); return new Roman(romNumber); } }
While (!.) Pattern.Matches ("MDCLXVI", firstRoman))
Try "[MDCLXVI] *" and see if it's better
{
System.out.Print ("a valid Roman Number please try again");
firstRoman = firstRoman.toUpperCase ();
}My Code is as follows:
// Ask for user to input firstRoman Number System.out.print("Enter your first Roman Number:"); // add the Roman Number to the String variable firstRoman = keyboard.nextLine(); firstRoman = firstRoman.toUpperCase();
Once they enter in the it, I want to check to make sure that it has characters MDCLXVI and if it contains any other characters then I will provide a new object Scanner keyboard to try again and if it fails again, it will go to the option to try again until they put in a string that contains only the characters above. I don't know where to go here to get the while loop has worked. New to Java and I got my program work properly when I put good known numbers of novel, but I want to take incorrect entries.
Any help would be appreciated.
Thank you
WallyI put the code for my main program and my class below just in case. I have already met the requirements of the teacher if the project is done, I'm just trying to improve.
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package myname.project.pkg6; import java.util.Scanner; import java.util.regex.Pattern; /** * * @author wsteadma */ public class mynameProject6 { /** * @param args the command line arguments */ public static void main(String[] args) { // Used for testing String firstRoman; String secondRoman; Scanner keyboard = new Scanner(System.in); // Ask for user to input firstRoman Number System.out.print("Enter your first Roman Number:"); // add the Roman Number to the String variable firstRoman = keyboard.nextLine(); firstRoman = firstRoman.toUpperCase(); // Ask for user to input secondRoman Number System.out.print("Enter your second Roman Number:"); // add the Roman Number to the String variable secondRoman = keyboard.nextLine(); // Add the name input into the name variable secondRoman = secondRoman.toUpperCase(); //Creating first instance of Roman Numbers class Roman firstNumber = new Roman(firstRoman); Roman secondNumber = new Roman(secondRoman); System.out.println("Printout of the created roman numbers"); //Prints out the Roman Number firstNumber.printRoman(); secondNumber.printRoman(); // Convert Roman to Decimal firstNumber.setDecimal(firstRoman); secondNumber.setDecimal(secondRoman); System.out.println("Viewing the Decimal values for the two defined instances"); //Prints decimal Numbers firstNumber.printDecimal(); secondNumber.printDecimal(); System.out.println("Adding the Roman Numbers and returning new Roman value"); Roman romanAdd; romanAdd = firstNumber.addRoman(secondNumber); romanAdd.printRoman(); System.out.println("Subtracting the Roman Numbers and return new Roman value"); Roman romanSub; romanSub = firstNumber.subRoman(secondNumber); romanSub.printRoman(); } }
CLASS:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package myname.project.pkg6; /** * * @author wsteadma */ public class Roman { private String romNumber; private int decNumber; public Roman(String rNumber) { romNumber = rNumber; } public String getRoman() { return romNumber; } public int getDecimal() { return decNumber; } public void printRoman() { System.out.println("The Roman Number is " + romNumber); } public void printDecimal() { System.out.println("The Decimal Number is " + decNumber); } // Converts a roman number string into a decimal value public int setDecimal(String romNum) { int charValue = 0; char[] characters = new char[romNum.length()]; //System.out.println("romNum length is " + romNum.length()); for (int counter = 0; counter < romNum.length(); counter++) { characters[counter] = romNum.charAt(counter); //System.out.println(characters[counter]); } for (int sCounter = 0; sCounter < romNum.length(); sCounter++) { if (characters[sCounter] == 'M' || characters[sCounter] == 'm') { charValue += 1000; } else if (characters[sCounter] == 'D' || characters[sCounter] == 'd') { charValue += 500; } else if (characters[sCounter] == 'C' || characters[sCounter] == 'c') { charValue += 100; } else if (characters[sCounter] == 'L' || characters[sCounter] == 'l') { charValue += 50; } else if (characters[sCounter] == 'X' || characters[sCounter] == 'x') { charValue += 10; } else if (characters[sCounter] == 'V' || characters[sCounter] == 'v') { charValue += 5; } else if (characters[sCounter] == 'I' || characters[sCounter] == 'i') { charValue += 1; } } decNumber = charValue; return charValue; } // Converts a decomal number to a roman number public String setDec2Roman(int decNum) { String newRoman = ""; while (decNum >= 1000) { newRoman += "M"; decNum -= 1000; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 500) { newRoman += "D"; decNum -= 500; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 100) { newRoman += "C"; decNum -= 100; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 50) { newRoman += "L"; decNum -= 50; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 10) { newRoman += "X"; decNum -= 10; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum >= 5) { newRoman += "V"; decNum -= 5; //System.out.println(decNum); //System.out.println(newRoman); } while (decNum > 0) { newRoman += "I"; decNum -= 1; //System.out.println(decNum); //System.out.println(newRoman); } return newRoman; } public Roman addRoman(Roman newRom) { int totRom = newRom.setDecimal(newRom.romNumber) + decNumber; romNumber = newRom.setDec2Roman(totRom); return new Roman(romNumber); } public Roman subRoman(Roman subRom) { int totRom = decNumber - subRom.setDecimal(subRom.romNumber); romNumber = subRom.setDec2Roman(totRom); return new Roman(romNumber); } }
-
How to allow the user to enter only alpha numeric characters in the text field?
Hello
Is it possible to restrict the user to enter only alpha numeric characters in the textfiled?
Thank you
Starting from the version 4.7, I don't see any how useful filter adapted to your needs. Then why don't you override keyChar() like this:
EditField eField = new EditField("Enter letters and digits only: ", "") { protected boolean keyChar(char ch, int status, int time) { if (CharacterUtilities.isLetter(ch) || CharacterUtilities.isDigit(ch) || (ch == Characters.BACKSPACE)) { return super.keyChar(ch, status, time); } return true; } };
I have not tested this code, but you can give it a shot...
You can add a manipulation (or super.keyChar...) for Characters.ENTER and Characters.ESCAPE, as well as anything else you be useful, such as the comma and the period.
Hope this helps,
Arkady.
Edit: added Characters.BACKSPACE - you want to change, not you?
-
Function DEFINITION, remove the chain alpha characters
I'm on 11g.
I need to remove the alpha of a string characters, leaving only numbers, but I get unexpected results:
SQL > SELECT TRANSLATE ('3N', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', NULL) a FROM DUAL;
A
-
I thought that this would leave 3 of the 3N, but it returns an empty string. For my application, the string "3N" could be any length, will contain only letters and numbers and letters will always come at the end, but there might be more than one letter
VALID INPUT samples:
4
25
11F
361NG
8ABC
Is there a better way?You must give a valid replacement at least, and then the rest will be replaced with null as the address:
SELECT TRANSLATE('3N', '1ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1') a FROM DUAL;
Published by: chris227 on 07.02.2013 08:37
Sorry, I forgot the 1 in the second parameter
Maybe you are looking for
-
How can I update my iphone 6 s to the ios10, it is now in recovery mode
When I want to update via itunes that arising out of the message that is updated to ios 9.3.5 but I want ios 10
-
Save chart as image (activeX) excel
Hello community, I generate files xls to couple of thousands who have some data, and a chart on the first sheet. Once the files are generated, I would like to sweep through all of them and save the chart as an image (BMP, GIF, PNG, whatever). I have
-
Reset administrative password seems to not work.
I get 'error' whenever I press NEXT after entering my NEW password. I did a system restore on my laptop which brought to factory condition. The administrator password I don't know, isn't allowing me to enter my laptop and when I try to use the wiza
-
Windows problem Photo Gallery: cannot open pictures on the desktop
I use Windows Photo Gallery problem as the program default to open images and has long had no problem with it. But now when I try to double click on an image .jpg on my desktop, nothing happens. When I drag & drop the exact same photo file to 'my p
-
Reinstall: windows 7 Home premium for error 0x80fe0000
HelloI'm currently updating my os to windows 7 Home premium 64 bit (clean install). Here is my system specVGA card xfx gtx 275latest version of the downloaded driverformula of motherboad asus crosshair 2latest drivers downloadedC.P.F. amd phenom 2 94