Find no numbers characters in a string
HI, how i can find no numbers characters in a string
By example.
'45125454564#4545'.
I only want to know if the string contains no number characters or not, i dont want to know the character '#'.
Is there a function module for doing that?
Thanks
You can try:
NUMERIC_CHECK
OR
IF var CO '0123456789'.
ENDIF.
Similar Messages
-
Find Substring + 2 characters in a string
I have the following string: 1.0000000000000000E+01
I need to find subtring E+01 and delete it from the string.
problem is thet 01 can be anything and changes.
I need an expression that will find a subtring starting E+ and two characters that come after ie 01
<removed_by_moderator>
Edited by: Julius Bussche on Sep 15, 2009 10:31 AMHi,
Try the below code;
Data : str(100) type C value '1.0000000000000000E+01'.
Data : len type i.
len = strlen( str ) - 4.
str = str+0(len).
This will solve the problem.
>
Maksims Jegorovcevs wrote:
> Will award points pls help.
Do not offer points its against [Forum Rules|http://wiki.sdn.sap.com/wiki/x/FgQ].
Regards
Karthik D -
Find non alpha characters in a string/email
HI,
I'm on 10g database.
I want to find out a list of email address where there are non alpha characters in an email .
Example
KEY1 EMAIL
1 [email protected]
2 [email protected]
3 AXIAP#[email protected] can i find out the emails with "#" and "-" characters only.
Thanks
Edited by: user527060 on Aug 14, 2009 8:15 AMHey Centinul, you have a DUP_VAL_ON_INDEX ;)
It's friday after all
SQL> with t as (
2 select 1 key1, '[email protected]' email from dual union all
3 select 2,'[email protected]' from dual union all
4 select 3,'AXIAP#[email protected]' from dual
5 )
6 select key1
7 , email
8 from t
9 where length(regexp_replace(substr(email, 1, instr(email, '@') -1), '[[:alnum:]]')) is not null;
KEY1 EMAIL
1 [email protected]
3 AXIAP#[email protected]
2 rows selected.http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html
http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt2.html
However regexp consume CPU, why not just simply:
SQL> with t as (
2 select 1 key1, '[email protected]' email from dual union all
3 select 2,'[email protected]' from dual union all
4 select 3,'AXIAP#[email protected]' from dual
5 )
6 select key1
7 , email
8 from t
9 where email like '%#%'
10 or email like '%-%';
KEY1 EMAIL
1 [email protected]
3 AXIAP#[email protected]
2 rows selected.if you're only interested in finding # or - occurences in an emailaddress? -
How to find 2 different characters from a string
Hi All,
I would like to remove 'T' and 'Z' from "20110428T10:33:45Z" and convert the string in date/time. I was looking at instr function but that allows to search for one character only.
Thans for the help.With 10g
SELECT REGEXP_REPLACE ('20110428T10:33:45Z', '[T|Z]') dt
FROM DUAL
DT
2011042810:33:45
1 row selected.For the conversion
SELECT TO_DATE (REGEXP_REPLACE ('20110428T10:33:45Z', '[T|Z]'),
'YYYYMMDDHH24:MI:SS'
) dt
FROM DUAL
DT
2011-04-28 10:33:45
1 row selected. -
Count of characters in a string
Hi all,
Is there any way to find the repeating characters in the string like 'L' in the example Hello ..
Thanks in advance,
Nalla !
Message was edited by: Nalla
Nalla (Nallasivam)test@ORA10G>
test@ORA10G> with t as (
2 select 'hello' as str from dual union all
3 select 'abracadabra' from dual union all
4 select 'the quick brown fox jumps over the lazy dog' from dual union all
5 select 'abcdefghijklmnopqrstuvwxyz' from dual union all
6 select 'facetious' from dual)
7 --
8 select
9 str
10 from t
11 where (
12 length(str) - length(replace(lower(str),'a')) > 1 or
13 length(str) - length(replace(lower(str),'b')) > 1 or
14 length(str) - length(replace(lower(str),'c')) > 1 or
15 length(str) - length(replace(lower(str),'d')) > 1 or
16 length(str) - length(replace(lower(str),'e')) > 1 or
17 length(str) - length(replace(lower(str),'f')) > 1 or
18 length(str) - length(replace(lower(str),'g')) > 1 or
19 length(str) - length(replace(lower(str),'h')) > 1 or
20 length(str) - length(replace(lower(str),'i')) > 1 or
21 length(str) - length(replace(lower(str),'j')) > 1 or
22 length(str) - length(replace(lower(str),'k')) > 1 or
23 length(str) - length(replace(lower(str),'l')) > 1 or
24 length(str) - length(replace(lower(str),'m')) > 1 or
25 length(str) - length(replace(lower(str),'n')) > 1 or
26 length(str) - length(replace(lower(str),'o')) > 1 or
27 length(str) - length(replace(lower(str),'p')) > 1 or
28 length(str) - length(replace(lower(str),'q')) > 1 or
29 length(str) - length(replace(lower(str),'r')) > 1 or
30 length(str) - length(replace(lower(str),'s')) > 1 or
31 length(str) - length(replace(lower(str),'t')) > 1 or
32 length(str) - length(replace(lower(str),'u')) > 1 or
33 length(str) - length(replace(lower(str),'v')) > 1 or
34 length(str) - length(replace(lower(str),'w')) > 1 or
35 length(str) - length(replace(lower(str),'x')) > 1 or
36 length(str) - length(replace(lower(str),'y')) > 1 or
37 length(str) - length(replace(lower(str),'z')) > 1
38 );
STR
hello
abracadabra
the quick brown fox jumps over the lazy dog
3 rows selected.
test@ORA10G>
test@ORA10G>pratz -
How to find out if there are repeated characters in a string
hey guys
well i kinda have a little problem figuring out how to find out
if there are repeated characters in a string.
if anyone can help, would appreciate it.
thanks
milosTry using the StringTokenizer class. if u already know which character to trace. this could do the job.
eg. String str = "here and there its everywhere";
StringTokenizer st = new StringTokenizer(str, "e");
int rep = st.countTokens(); -
Finding the total size of a string when number of characters are known.
Hi: I am having trouble inserting a field in a record that is CLOB. The number of characters in the string is 59298. Any idea how to know what is the size of this string? I am trying to figure out if I am exceeding the size of the string. The error I get is the following
ORA-06512: at "SYS.DBMS_LOB", line 789
ORA-06512: at line 1
Second exception: ORA-21560: argument 2 is null, invalid, or out of range
ORA-06512: at "SYS.DBMS_LOB", line 789
Thanks
RayEither your stacktrace is incomplete or you make something wrong by copy/paste. And please, by providing sql/plsql code, use the tags [ code ] [ / code ] or [ pre ] [ / pre ], otherwise it is very hard to read.
Here is small demonstration of what i mean by 3rd parameter:
SQL> CREATE TABLE T_LOB(ID NUMBER,MESSAGE CLOB)
2 /
Table created.
SQL> DECLARE
2 l_clob CLOB;
3 BEGIN
4 INSERT INTO t_lob VALUES(1,'Hello')
5 RETURNING message INTO l_clob;
6 dbms_lob.writeappend(l_clob,length(',world'));
7 END;
8 /
dbms_lob.writeappend(l_clob,length(',world'));
ERROR at line 6:
ORA-06550: line 6, column 1:
PLS-00306: wrong number or types of arguments in call to 'WRITEAPPEND'
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
SQL> DECLARE
2 l_clob CLOB;
3 BEGIN
4 INSERT INTO t_lob VALUES(1,'Hello')
5 RETURNING message INTO l_clob;
6 dbms_lob.writeappend(l_clob,length(',world'),',world');
7 END;
8 /
PL/SQL procedure successfully completed.
SQL> SELECT * FROM t_lob
2 /
ID MESSAGE
1 Hello,worldIn your examples, after length('some lengthy string...' there is no more parameters to dbms_lob.writeappend ( or i don't see any).
Best regards
Maxim -
How do I drop the last 3 characters in a string?
Hello. I'm trying to find a way to drop the last 3 characters in a string. The length varies because it is a last name field. The problem is that when a customer has a suffix on their name, III for example, it is appended to the last name all in the last name field. If I use the ProperCase function, I end up with "Smith Iii". How can I tell it to drop the last 3 characters? I'll then append an UpperCase edition of the last 3 characters to that. Thank you!
Use the instring and right string functions then UpperCase
-
Need help in replacing special characters in a string
Hi,
please let me know the best way to replace all the special characters in a string with space.
other than alphabets and numbers
with regards.
sumanth.please let me know the best way to replace all the special characters in a string with space.
other than alphabets and numbers
>
Sumanth Nag Kristam wrote:
> actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
> any pointers....
>
> chk the link for the ASCII codes
> http://www.techonthenet.com/ascii/chart.php
But in Hexa decimal value there is no special characters? -
Scanning values of characters in a string
Hey guys,
I'm trying to figure out a way I can scan the individual characters of a string to find their value [unicode value, if it's a number, punctuation etc] and I'm a bit stumped. I know I'll have to be using the chatAt method, but I can't think of how I could implement this to continuiously scan through a string.
If someone could help point me in the right direction it would be great.
Thanks in advance.Do you know what a loop is?
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html
Do you know how to find out about methods of the String class such as toCharArray?
http://java.sun.com/javase/6/docs/api/java/lang/String.html -
Replace multiple characters in a string
Hi, I have some string fields that contain special characters such as ô and û and I want to replace them with ō and ū, and their upper case equivalents as well. How do I write a single formula that would find any of these characters in a string and replace them?
Thanks,
Willreplace(replace(replace(replace(x,'ô','ō'),'û','ū'),'Ô','Ö'),'Û','Ü');
where x is the string field. I suggest using the unicodes rather than the actual character. I do not think that I have the correct uppercase characters. Please ensure that they are correct in your formula. -
Number of characters in a string
Hi,
I need to find the number of characters in a string. For instance, i have a string type variable with the value "ABAP". How can i know how many letters "A" there are in that string? Is there any FM that does this?
Cheers,
RobertoHi,
you can make use of string operation FIND as:
DATA: text1 TYPE string VALUE `A`,
text TYPE string,
off TYPE i,
moff TYPE i,
mlen TYPE i.
off = 0.
WHILE sy-subrc = 0.
FIND text1 IN SECTION OFFSET off OF
`ABAP`
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc = 0.
WRITE / moff.
off = moff + mlen.
ENDIF.
ENDWHILE. -
Repeated characters in a string????
hey guys
well i kinda have a little problem figuring out how to find out
if there are repeated characters in a string.
if anyone can help, would appreciate it.
thanks
milosAnd now a working version:
public boolean hasRepeatedChars (String word) {
boolean found = false;
int i = 0;
char lastChar = '\0';
while ((i != word.length ()) && ! found) {
char c = word.charAt (i);
found = ((i != 0) && (c == lastChar));
lastChar = c;
i ++;
return found;
} -
Removing characters from a String (concats, substrings, etc)
This has got me pretty stumped.
I'm creating a class which takes in a string and then returns the string without vowels and without even numbers. Vowels and even characters are considered "invalid." As an example:
Input: "hello 123"
Output: "hll 13"
The output is the "valid" form of the string.
Within my class, I have various methods set up, one of which determines if a particular character is "valid" or not, and it is working fine. My problem is that I can't figure out how to essentially "erase" the invalid characters from the string. I have been trying to work with substrings and the concat method, but I can't seem to get it to do what I want. I either get an OutOfBoundsException throw, or I get a cut-up string that just isn't quite right. One time I got the method to work with "hello" (it returned "hll") but when I modified the string the method stopped working again.
Here's what I have at the moment. It doesn't work properly for all strings, but it should give you an idea of where i'm going with it.
public String getValidString(){
String valid = str;
int start = 0;
for(int i=0; i<=valid.length()-1; i++){
if(isValid(valid.charAt(i))==false){
String sub1 = valid.substring(start, i);
while(isValid(valid.charAt(i))==false)
i++;
start=i;
String sub2 = valid.substring(i, valid.length()-1);
valid = sub1.concat(sub2);
return valid;
}So does anybody have any advice for me or know how I can get this to work?
Thanks a lot.Thansk for the suggestions so far, but i'm not sure how to implement some of them into my program. I probably wasn't specific enough about what all I have.
I have two classes. One is NoVowelNoEven which contains the code for handling the string. The other is simply a test class, which has my main() method, used for running the program.
Here's my class and what's involved:
public class NoVowelNoEven {
//data fields
private String str;
//constructors
NoVowelNoEven(){
str="hello";
NoVowelNoEven(String string){
str=string;
//methods
public String getOriginal(){
return str;
public String getValidString(){
String valid = str;
int start = 0;
for(int i=0; i<=valid.length()-1; i++){
if(isValid(valid.charAt(i))==false){
String sub1 = valid.substring(start, i);
while(isValid(valid.charAt(i))==false)
i++;
start=i;
String sub2 = valid.substring(i, valid.length()-1);
valid = sub1.concat(sub2);
return valid;
public static int countValidChar(String string){
int valid=string.length();
for(int i=0; i<=string.length()-1; i++){
if(isNumber(string.charAt(i))==false){
if((upperVowel(string.charAt(i))==true)||lowerVowel(string.charAt(i))){
valid--;}
else if(even(string.charAt(i))==true)
valid--;
return valid;
private static boolean even(char num){
boolean even=false;
int test=(int)num-48;
if(test%2==0)
even=true;
return even;
private static boolean isNumber(char chara){
boolean number=false;
for(int i=0; i<=9; i++){
if((int)chara-48==i){
number=true;
return number;
private static boolean isValid(char chara){
boolean valid=true;
if(isNumber(chara)==true){
if(even(chara)==true)
valid=false;
if((upperVowel(chara)==true)||(lowerVowel(chara)==true))
valid=false;
return valid;
}So in my test class i'd have something like this:
public class test {
public static void main(String[] args){
NoVowelNoEven test1 = new NoVowelNoEven();
NoVowelNoEven test2 = new NoVowelNoEven("hello 123");
System.out.println(test1.getOriginal());
//This prints hello (default constructor string is "hello")
System.out.println(test1.countValidChar(test1.getOriginal()));
//This prints 3
System.out.println(test1.getValidString());
//This SHOULD print hll
} -
Validating Characters in a String
Hey everyone first post here, I have a question about validating characters in a string. I have a program where u need to enter an item code and it must have 2 letters in the begining and 3 numbers at the end, all one word.
Now I already have an error test to see whether or not the string is 5 characters and all that but i have no idea where to start on checking whether or not each character meets the criteria, i've thought of checking each character individually but I thought there had to be an easier way.yea right now i'm completley lost, i kind of
understand regex but i just have no idea how i would
type it out, Go step by step. You want a string that has five characters. The first
test could be this (let's call that string 'string' by lack of creativity):if (string == null || string.length() != 5) return false;This is the first test: if there is no string or if it doesn't contain five
characters, all bets are off. Here's the second test:for (int i= 0; i < 2; i++)
if (!Character.isLetter(string.charAt(i)))
return false;If the first two characters aren't letters the string is incorrect (according
to your specifications). Here's the last test:for (int i= 2; i < 5; i++)
if (!Character.isDigit(string.charAt(i)))
return false;If all those tests succeed, you simply do this:return true;All you have to do now is join these code fragments in a simple method
and you're in business. Comprendo, partner?
kind regards,
Jos
Maybe you are looking for
-
No apps are showing up in the desktop window.
I have Creative Cloud installed, the desktop window shows up but there are no apps in the window, the time icon just sits and spins and spins. We have a company membership. What's wrong?
-
Frozen ipod after new updates, will not recover, error codes 1601 and 1602
i updated my ipod last night, was working fine, turned off, then on again this morning. was working fine this morning for a while, then went completely blank, will not start up, just completely dead. i have tried to restore,several times and get erro
-
Hi. I have dataGrid where i insert rows. For this reason i use this code: public void createLOADetails() OAViewObject vo = (OAViewObject)getLOADetailsVO1(); if (!vo.isPreparedForExecution()) vo.executeQuery(); Row r = vo.createRow(); //вставляем пуст
-
Setup E2500 with Slingbox Solo
Slingbox no longer uses software, but is now web based. I got a new computer and when I go to the site it can't locate my slingbox on their network. Does anyone have a step by step instruction on how to address this issue? When I go to the site and s
-
Not able to see iMac when running Vista in Bootcamp
I have been googling away to try and resolve this issue and have found nothing that helps. Hope someone can help here. I have a 20" 2.4Ghz iMac Core 2 Duo running Leopard and just installed Vista Home premium under Bootcamp. My problem is that I am u