Find out if a string contains only ASCII characters

后端 未结 3 1445
傲寒
傲寒 2020-12-06 15:07

I need to know whether a string contains only ASCII characters. So far I use this REGEX:

DECLARE
    str VARCHAR2(100) := \'xyz\';
BEGIN
    IF REGEXP_LIKE(s         


        
3条回答
  •  甜味超标
    2020-12-06 15:31

    I think I will go for one of these two

    IF CONVERT(str, 'US7ASCII') = str THEN
        DBMS_OUTPUT.PUT_LINE('Pure ASCII');
    END IF;
    
    
    
    IF ASCIISTR(REPLACE(str, '\', '/')) = REPLACE(str, '\', '/') THEN
        DBMS_OUTPUT.PUT_LINE('Pure ASCII');
    END IF;
    

提交回复
热议问题