🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8273

Check for *all* alphanumeric characters...

#8273
From: Valentino Kyriakides
Date: Wed, 04 Apr 2001 16:22
32 lines
1923 bytes
Hi,

the following code fragment shows a simple alphanumeric character check
method, which checks if any char inside a passed string is alphanumeric. -
Java's "isLetterOrDigit(char)" method's behaviour from the string class
seems not to include whitespaces, punctuation chars like ".", the "@" sign
and german umlauts (�������) etc.

Isn't there some equivalent method available which provides something
similar to "isASCII", which looks for all chars from ...say... the extended
ASCII charater set or unicode set, so that all above mentioned chars will be
recognized?

....
 // check for a string only containing alphanumeric characters
    private boolean check_alphanumeric (String inputField)
    {
     char array[] = inputField.toCharArray();
     Character chr = new Character(' ');
     int i = 0;

     while (i < inputField.length()) {
      if (!chr.isLetterOrDigit (array[i]))
       return false;
      i++;
     }
     return true;
    }
...
...

Valentino
Technical Details
Message-ID: <3acb4854_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!europa.netcrusader.net!128.230.129.106!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,6f88753f3998c69d,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-04 09:44:13 PST
From: "Valentino Kyriakides" <vkyr@ision.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Check for *all* alphanumeric characters...
Date: Wed, 4 Apr 2001 18:22:04 +0200
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 195.180.208.145
Message-ID: <3acb4854_2@dnews>
X-Trace: dnews 986400852 195.180.208.145 (4 Apr 2001 09:14:12 -0700)
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!europa.netcrusader.net!128.230.129.106!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews