Check for non-numeric characters in textbox input
I have a form with several textboxes, each of which can accept numeric input. I want to write a validation/ plsql block that checks for a non-numeric character in the input, so that my user sees a customized error message rather than a database error. Any tips on how I can achieve that? Is there any function like "isalpha" in C, which can directly do the job?
Also, some of these numeric fields should allow commas, since people put commas in larger numbers.
Any help is greatly appreciated.
Arie,
i figured it out. turns out, i had some confusion in my mind. i modified Taneal's solution to use it in my already existing validations of type 'function returning error text' and it works fine.
the problem before was that i was running 2 separate validations on the same field, and probably due to the sequence numbers, i was getting a numeric or value error. now, i've combined all validations into a single validation and it works fine.
and honestly, i'm pretty bad with reg. ex. :D
Similar Messages
-
Safari "tel:" phone number links stripping non-numeric characters
After a week of owning my iPhone (two weeks after it launched) I made myself a little web interface that contain various iPhone-helpful links. Four of these were AT&T specific telephone links:
*646# - check how many minutes remaining
*729 - pay your bill
etc etc..
(e.g. <a href="tel:*729">click here to pay your bill</a>)
Well, needless to say this was a very convenient feature, however these links no longer function properly. It seems that the iPhone is now stripping any/all non-numeric characters from the link (although I haven't done extensive testing to see exactly which characters .. only with * and $ in particular).
I've even tried HTML entities but they were stripped too.
Now I know apple had a security fix a few patches back, one that fixed a vulnerability involving "tel:" links (CVE-2007-3755), but I haven't found any documentation regarding special characters now being ignored/stripped.
So, my question is does anyone know if there is a workaround for this, or did the patch inadvertently and permanently destroy the ability to send these very helpful text messages via a web interface?
Thanks,
MarcI'm having a similarly annoying behavior with "tel:" links. I'm doing the same thing -- writing a web page to store some convenient numbers, but for me, it's for teleconference numbers. You dial into a toll-free number, then after a pause, dial in a passcode.
On the iPhone's contact list, you can program in the pauses as the letter "p."
However, in a tel: link, the p's change to 7's. Interesting!
What I've discovered is that, for me (FW 1.1.2), alphabetical characters are translated into their numerical equivalents. So 1-800-COMCAST (a number I've had to dial all too much recently) gets rendered to 18002662278.
This is a difference between Safari 3 and the iPhone version. On Safari 3 on the Mac, both the HTML and a mouseover shows that the tel link contains the letters. On the iPhone, though, clicking the link brings up a dialog box with the letters "translated."
So, interesting -- but now I have a problem. How do I enter a pause into a tel link? -
PDF generation for Non English Characters from ADF
Hi
We are using below piece of code to generate pdf from ADF Managed bean. It works fine. However for non English Characters(eg. Japanese,Vietnamese,Arabic) it puts
I got few blogs
https://blogs.oracle.com/BIDeveloper/entry/non-english_characters_appears
However we are not using BI Publisher product . We are using its API's
Can anyone tell where do we need to setup fonts within ADF or Weblogic or Server ?
Input Parameters are
a)xml Data
b)InputStream ie rtf Template
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.template.FOProcessor;
import oracle.apps.xdo.template.RTFProcessor;
public static byte[] genPdfRep(String pOutFileType,byte[] pXmlOut ,InputStream pTemplate)
byte[] dataBytes = null;
try {
//Process RTF template to convert to XSL-FO format
RTFProcessor rtfp = new RTFProcessor(pTemplate);
ByteArrayOutputStream xslOutStream = new ByteArrayOutputStream();
rtfp.setOutput(xslOutStream);
rtfp.process();
//Use XSL Template and Data from the VO to generate report and return the OutputStream of report
ByteArrayInputStream xslInStream = new ByteArrayInputStream(xslOutStream.toByteArray());
FOProcessor processor = new FOProcessor();
ByteArrayInputStream dataStream = new ByteArrayInputStream((byte[])pXmlOut);
processor.setData(dataStream);
processor.setTemplate(xslInStream);
ByteArrayOutputStream pdfOutStream = new ByteArrayOutputStream();
processor.setOutput(pdfOutStream);
byte outFileTypeByte = FOProcessor.FORMAT_PDF;
processor.setOutputFormat(outFileTypeByte); //FOProcessor.FORMAT_HTML
processor.generate();
dataBytes = pdfOutStream.toByteArray();
} catch (XDOException e) {
e.printStackTrace();
return dataBytes;
Appreciate your help.
Thanks,
AbhijitFonts are defined in the template you use to generate the pdf. Your application add the data and both is processed yb the FOP processor. Now there are two possible causes of the '???' :
1. the data you sent to the template contains the '???' already
2. the template can't digest the data (the special characters) and puts '???' in the pdf.
Before going on you have to find out which one is your problem. The 2nd is the problem you better ask this in a FOP forum as you have to solve it by changing the template.
Timo -
How can I remove non-numeric characters from a cell?
I have a file an rtf file that I can open in Numbers. It puts each line in a separate cell. Each cell contains non-numeric and numeric characters. I'd like to delete the non-numeric characters so that I can add the numbers together. Is there a way to do this easily in Numbers that doesn't require doing it manually?
Thanks,
DavidOk, David,
This solution will work for vlaues up to 99,000 and if there is a space in front of your amount. There are two parts for clarity but you could wrap them up into one formula if you wanted to.
B2 =FIND(" ",A2,LEN(A2)−9)
C2 =MID(A2,B2,10)
If there is a return before your amount (certain cells in your screenshot got me wondering) then the formula in column B
=FIND("
",A2,1)
It looks funny because it is finding the return.
Let me know if this works for you.
quinn -
Removing non-numeric characters from string
Hi there,
I need to have the ability to remove non-numeric characters from a string and I do not know how to do this.
Does any one know a way?
Example:
Present String: (02)-2345-4607
Required String: 0223454607
Thanks in advanceDear NickM
Try this this will work...........
create or replace function char2num(mstring in varchar2) return integer
is
-- Function to remove Special characters and alphebets from phone no. string field
-- Author - Valid Bharde.(India-Mumbai)
-- Date :- 20 Sept 2006.
-- This Function will return numeric representation.
-- The Folowing program is gifted to NickM with respect to his post on oracle site regarding Removing non-numeric characters from string on the said date
mstatus number :=0;
mnum number:=0;
mrefstring varchar2(50);
begin
mnum := length(mstring);
for x in 1..mnum loop
if (ASCII(substr(upper(mstring),x,1)) >= 48 and ASCII(substr(upper(mstring),x,1)) <= 57) then
mrefstring := mrefstring || substr(mstring,x,1);
end if;
end loop;
return mrefstring;
end;
copy the above program and use it at function for example
SQL> select char2num('(022)-453452781') from dual;
CHAR2NUM('(022)-453452781')
22453452781
Chao!!! -
Catching errors such as divide by zero and typing non-numeric characters
Fellows: How do I extend following script to catch errors such as divide by zero and typing non-numeric characters. Thanks
This program takes two integers (whole numbers), then displays the sum, average, division,
Modula of those numbers and finally the first number raised to the power of the second number.
import java.io.*;
public class HWOne
public static void main(String[] args) throws IOException // error handling
// variable declaration
String firstdigit, seconddigit;
int first, second, sum, total, modus, power;
float division;
double average;
BufferedReader myIn = new BufferedReader(new InputStreamReader(System.in));
//Invoke user response
System.out.print("Please enter first digit ");
firstdigit = myIn.readLine();
first = Integer.parseInt(firstdigit);
System.out.print("Please enter second digit ");
seconddigit = myIn.readLine();
second = Integer.parseInt(seconddigit);
//computations
sum = first + second;
average = (double)sum / (double)2;
division = (float)first / (float)second;
modus = first % second;
power = (int)Math.pow(first, second);
//Screen message
System.out.println("Sum: " + sum);
System.out.println("Average: " + average);
System.out.println("Division: " + division);
System.out.println("Modula: " + modus);
System.out.println("Power: " + power);Have you learnt about try/catch statements yet?
The parseInt method throws a NumberFormatException. So you place the call to that method inside a try statement and catch the exception.
For divide by zero, you can use an if statement. If the divisor != 0 perform division. -
SetMnemonic for non-english characters
Does anybody knos how to set JButtons mnemonic for non-english characters?
My mnemonic is loaded from a resource bundle, and in the documentation the setMnemonic(char) is only limited to english and it is written that the user should call setMnemonic(int) instead.
So what value should this int contains in order to display the non-english char which is loaded from resource bundle?
Thanks in advanve,
HanochIt seems that this is an issue that has popped up in various forums before, here's one example from last year:
http://forum.java.sun.com/thread.jspa?forumID=16&threadID=490722
This entry has some suggestions for handling mnemonics in resource bundles, and they would take care of translated mnemonics - as long as the translated values are restricted to the values contained in the VK_XXX keycodes.
And since those values are basically the English (ASCII) character set + a bunch of function keys, it doesn't solve the original problem - how to specify mnemonics that are not part of the English character set. The more I look at this I don't really understand the reason for making setMnemonic (char mnemonic) obsolete and making setMnemonic (int mnemonic) the default. If anything this has made the method more difficult to use.
I also don't understand the statement in the API about setMnemonic (char mnemonic):
"This method is only designed to handle character values which fall between 'a' and 'z' or 'A' and 'Z'."
If the type is "char", why would the character values be restricted to values between 'a' and 'z' or 'A' and 'Z'? I understand the need for the value to be restricted to one keystroke (eliminating the possibility of using ideographic characters), but why make it impossible to use all the Latin-1 and Latin-2 characters, for instance? (and is that in fact the case?) It is established practice on other platforms to be able to use characters such as '�', '�' and '�', for instance.
And if changes were made, why not enable the simple way of specifying a mnemonic that other platforms have implemented, by adding an '&' in front of the character?
Sorry if this disintegrated into a rant - didn't mean to... :-) I'm sure there must be good reasons for the changes, would love to understand them. -
Duplicate check for non inventory vendor invoices in Finance
Hi,
SAP provides duplicate check for non inventory vendor invoices posted through transactions F-43 and FB01 etc. The field values checked for duplicate invoice include Document date and Reference field.
I want to know, is there any flexibility of removing Document date from checking criteria?
This is to facilitate picking more invoices in duplicate check net.
Regards,
VijayDear Vijay
Yes, you can control this via business transaction events. Please review the below explanation.
In Rel 4.6, duplicate invoices are checked using function module
FI_DUPLICATE_INVOICE_CHECK which is called when invoices are posted via trans FB60. Duplicate invoice checking criteria can be customized using the open FI interface SAMPLE_PROCESS_00001110 (custom function module) starting from Rel 4.6. Please verify if the open FI interface 00001110 is being used in your system and review duplicate invoice selection criteria via trans BERP. You may wish to omit the document date (BLDAT field from the duplicate invoice check criteria to trigger error msg F5117. In addition, table BSIP (vendor duplicate documents) may need to be updated. (see note 114563 for further info).
Please also check note 537213, and note 31771 for your information.
If this helps please reward with points.
Best Regards
Kesav -
Word Replacements for Non- English Characters
Hi
Does anyone have an idea on implementing Word Replacements for non- english characters in TCA- DQM 11i.
We are trying to identify, capture and cleanse common accented characters like à, â , ê
However, the default language for replacement is American English , So even if we add these in the existing lists it will not take any effect
Is creating a new Word replacement list for every language the solution ?? any patch recommendations???
Thanks in advanceIt seems that this is an issue that has popped up in various forums before, here's one example from last year:
http://forum.java.sun.com/thread.jspa?forumID=16&threadID=490722
This entry has some suggestions for handling mnemonics in resource bundles, and they would take care of translated mnemonics - as long as the translated values are restricted to the values contained in the VK_XXX keycodes.
And since those values are basically the English (ASCII) character set + a bunch of function keys, it doesn't solve the original problem - how to specify mnemonics that are not part of the English character set. The more I look at this I don't really understand the reason for making setMnemonic (char mnemonic) obsolete and making setMnemonic (int mnemonic) the default. If anything this has made the method more difficult to use.
I also don't understand the statement in the API about setMnemonic (char mnemonic):
"This method is only designed to handle character values which fall between 'a' and 'z' or 'A' and 'Z'."
If the type is "char", why would the character values be restricted to values between 'a' and 'z' or 'A' and 'Z'? I understand the need for the value to be restricted to one keystroke (eliminating the possibility of using ideographic characters), but why make it impossible to use all the Latin-1 and Latin-2 characters, for instance? (and is that in fact the case?) It is established practice on other platforms to be able to use characters such as '�', '�' and '�', for instance.
And if changes were made, why not enable the simple way of specifying a mnemonic that other platforms have implemented, by adding an '&' in front of the character?
Sorry if this disintegrated into a rant - didn't mean to... :-) I'm sure there must be good reasons for the changes, would love to understand them. -
Replace Non-Numeric Characters with a Numeric Character in a String
Hi Guys,
I need to replace all the non-numeric characters (including embedded blanks & hyphen) in a string to a numeric character '1'.
The trailing blanks should not be replaced.
e.g. "P22233344455566" should be changed to "122233344455566"
& "49-1234567 " should be changed to "4911234567 "
Please help.Use [replace|http://help.sap.com/abapdocu_70/en/ABAPREPLACE_IN_PATTERN.htm] with a regular expression to translate any non-numeric character (i.e. any character not between 0 and 9) to 1:
REPLACE ALL OCCURENCES OF REGEX '[^0-9]' IN value WITH '1'.
Cheers, harald
p.s.: In older releases [translate|http://help.sap.com/abapdocu_70/en/ABAPTRANSLATE.htm] would also do the trick, but is more lengthy, because one would need to specify each individual character that should be replaced, e.g.:
TRANSLATE value TO UPPER CASE.
TRANSLATE value USING
' 1_1-1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1'. -
Removing Non-numeric characters from Alpha-numeric string
Hi,
I have one column in which i have Alpha-numeric data like
COLUMN X
+91 (876) 098 6789
1-567-987-7655
so on.
I want to remove Non-numeric characters from above (space,'(',')',+,........)
i want to write something generic (suppose some function to which i pass the column)
thanks in advance,
MandipThis variation uses the like operators pattern recognition to remove non alphanumeric characters. It also
keeps decimals.
Code Snippet
CREATE FUNCTION dbo.RemoveChars(@Str varchar(1000))
RETURNS VARCHAR(1000)
BEGIN
declare @NewStr varchar(1000),
@i int
set @i = 1
set @NewStr = ''
while @i <= len(@str)
begin
--grab digits or (| in regex) decimal
if substring(@str,@i,1) like '%[0-9|.]%'
begin
set @NewStr = @NewStr + substring(@str,@i,1)
end
else
begin
set @NewStr = @NewStr
end
set @i = @i + 1
end
RETURN Rtrim(Ltrim(@NewStr))
END
GO
Code to validate:
Code Snippet
declare @t table(
TestStr varchar(100)
insert into @t values ('+91 (8.76) \098 6789');
insert into @t values ('1-567-987-7655');
select dbo.RemoveChars(TestStr)
from @t -
Select only non-numeric characters
A
$
^
(78^*)5$#7
)!@#$0-99
_454*(&--0
+@#$%564
=123
How select only non-numeric characters from above table?Nilesh Hole,Pune, India wrote:
but i want a uniqe query.
suppose table have n number of rows then how i will wirte a query.Not sure what you mean? Do you want to select a list of distinct non-numeric characters used in your table? Then:
column "Distinct non-numeric chars" format a30
with t as (
select '!' a from dual union all
select '@' from dual union all
select '#' from dual union all
select '$' from dual union all
select '%' from dual union all
select '^' from dual union all
select '&' from dual union all
select '*' from dual union all
select '(78^*)5$#7' from dual union all
select ')!@#$0-99' from dual union all
select '_454*(&--0' from dual union all
select '+@#$%564' from dual union all
select '=123' from dual union all
select '135790' from dual
select distinct substr(a,column_value,1) "Distinct non-numeric chars"
from (
select regexp_replace(a,'[[:digit:]]') a
from t
where not regexp_like(a, '^[[:digit:]]+$')
table(
cast(
multiset(
select level
from dual
connect by level <= length(a)
as sys.odcinumberlist
Distinct non-numeric chars
+
=
$
Distinct non-numeric chars
^
14 rows selected.
SQL> SY. -
hi could you pls tell me how to do the subtotal for non-numeric fields in ALV.
see the following example
REPORT z_demo_alv_total.
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Document currency
END OF ty_vbak.
DATA:
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT vkorg kunnr vbeln netwr waerk
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global types
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA -
Disable typing of non-numeric characters for numeric item
Hi,
For numeric fields, Oracle Forms checks the entry after the user tries to move out of the item.
But, the requirement is to disable the typing of non-numeric keys when entering data in a numeric item.
pls tell me how to achieve this..
regards,
Asim.Hi Asim,
You can achieve this by using a PJC (or else you could try using some PL/SQL Code in the KEY-PRESSED Trigger or so.. but not sure).
There is a demo available on OTN on how to achive this using PJC
http://www.oracle.com/technology/sample_code/products/forms/index.html
You could see a Key Filter demo under JavaBeans/PJC Samples (all available as part of the Forms demos).
HTH.
Regards,
Arun -
Support issue for non-English characters (in html forms)
Hi group!
I just want to post an issue here and see if anyone else has the same problem. First off, Im running Windows XP MCE but the French version (not the english version). This may help find out where the problem really is.
Second, I know a bit of html and such, and I'm referring to HTML Character entities for this thread, there's a quite complete list here for reference: http://www.faqs.org/docs/htmltut/characterentitiesfamsupp69.html
I noticed that some, not all, non-English characters written in a textarea (which is, basically, a multi-lined input box) doesnt pass well or at all to the server when sending the form from Safari. Most of the time, the content of the text area is reduced to the beginning and ends where the first accentued character is met.
The most used French accents (é, à) are usually well interpreted (but may, once in a while, produce that bug too) by safari, but ô and î doesnt do that well.
Oddly, this bug doesnt happen all the time and doesnt "crash" in the same manner everytime.
So I started a thread just to see if there's anyone else having issues with any non-english characters mostly in forms. Probably flash/shockwave does work, but I'm not sure- I have not tested yet.
Acer Aspire 5044 Windows XP Turion 1.8GHz, 1Gb SDRam, ATI 200M xpressYes, it is a known issue. I also noticed that it sometimes works, but most of the time it does not. It will hopefully be solved in the future. According to http://www.apple.com/safari/download/ changes that will come include:
# Support for International users
# International text input methods
# Advanced text (contextual forms, international scripts)
Sony Vaio Windows XP
Maybe you are looking for
-
How do I export voice memos from my iPhone 5S to my iTunes?
I have numerous voice memos that I want to get off my iPhone. However, I don't want them deleted. Some of them are of my mom's voice (she recently passed away) so I REALLY don't want to lose those. I've searched the forum and I've been unable to f
-
ITunes LP - How can I return to the LP content while playing?
The other day I bought an iTunes LP (Pink Floyd - The Wall) which contains quite a lot of nice extra material. My problem is that to access that content you must start playing the album from the top, even if it's already playing. What I do is that I
-
Driver Pack No Longer Being Applied During Task Sequence
Hi all, So... this week a really strange issue manifested itself. I've been trawling through logs for the last day and I don't seem to be getting anywhere. A task sequence, which has been working for months and hasn't been changed, all of a sudden de
-
How do I move google calendar events to iCal?
how do I move google calendar events to iCal?
-
ORA-02263 when creating Report on Web Service Result
Hi, I'm using Application Express 4.2.1.00.08 and I'm having problems creating a report on web service result. This is the tutorial I'm using: http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/web_serv.htm (yes, I realize it's intended primarily f