String Language Checking

Hi,
what is the best way to check that a certain string matchs a certain language, for example i have user input name (String) where i need to validate that its Arabic, is it recommended to use the uni-code ranges checking, or is there a better way of doing so.
Thanks in advance

That question has been asked tons of times.
Mostly you are out of luck.
Using Unicode ranges you can check the script at best. And usually several languages share a script (many western languages share the Latin script, for example).
If you had more data about each language you need to identify (for example a complete dictionary of each language), then you could do a more in-depth analysis to find out which language it probably is. This can get hard (and even impossible) if the text you need to identify is short (just guess in how many languages "a" is a valid word).

Similar Messages

  • EBS search string for check number

    Hello Gurus
    My client is using MT940 FORMAT for EBS,requirement is in a bank statement we are having 10 transactions which are having the same amount for ex:rs.1000 for ten payment transactions. now system is not able to post the document when we import the bank statement.
    I wanted to use search string for check number,  note to payee in bank statement is check number.Please find the below refference
    /EI/400229001       010013
    0000010013
    Reference 010013
    How could i use search string for this i tried but im not getting the solution im getting the following error difference is too large F5 263.
    Appreciated for our help............
    Thanks a lot in advance...............

    Hi Paulo,
    Thanks for the reply. However i have the following setting and it still does not work..
    Mapping -> AB01
    When i do the simulation it shows the Number and the hits and mapping.
    In the Seach String use i have following settings:
    CC 1000
    Interpretation : ALL Interpretation
    Search String : TEST1 ( this is the name that i gave to above search string)
    Target : Posting RUle
    Active checked.
    But still when i upload the bank statement it is posting to Rule AB03 and not AB01
    Also when i try FEBSTS it says no document hits ???
    Your answer is greatly appreciated.

  • Can i turn a series of integers such as 1000-1200  into a string to check

    can i turn a series of integers such as 1000-1200 into a string to check positions with charAt I need to scan numers 1000-9999 to add the digits 1+0+0+0=1 or 9+9+9+9=36 to find the ones that when the result ie 36 is rased to the 4th power equal the original number? I want to scan charAt(position) then add those 4 positions.please help me
    heres my code so farpublic class Poweroffour
        public static void main(String[] args)
        int number;     
         String numberS;
        int numtotal;
         int numtotalpoweroffour;
         int num1;
         int num2;
         int num3;
         int num4;
         for (number=1000;number<10000;number++)
              numberS=number;
              num1=numberS.charAt(1);
              num2=numberS.charAt(2);
              num3=numberS.charAt(3);
              num4=numberS.charAt(4);
                 numtotal=num1+num2+num3+num4;
                 numtotalpoweroffour=numtotal*numtotal*numtotal*numtotal;
                 if (numtotalpoweroffour==number)
                      System.out.println(number);
        }}

    public class Poweroffour
        public static void main(String[] args)
            int numb=0;
             int thou=0;
            int hund=0;
            int tens=0;
            int ones=0;
            int total;
            int count;
           for (numb=1000;numb<10000;numb++)
                thou = numb/1000;
                hund = (numb -(thou *1000))/100;
                tens = ((numb % 100)- ones)/10;
                ones = numb % 10;
                System.out.println( thou + " " + hund + " " + tens + " " + ones);
    }          

  • "Host String" to check install

    Do I enter the SID into the host string to test install?
    On my server (Oracle 8i for Netware) in tnsnames.ora, I have a service variable and a SID. On my client (Oracle 8i for NT),in tnsnames.ora, I have a service variable and a
    Service Name variable.
    TIA. I am very new to this.

    The ability to detect the jre at the update level, as well as the ability to install a specific version are only present if the DT plugins are installed.
    These plugins only exist for windows and are only part of the 6u10 (1.6.0_10) versions of java.
    The javascript you show uses an undefined minimumVersion variable.
    also note, you cannot use the wildcard '1.5.0*' in the call to isWebStartInstalled (which takes minimumVersion arg)
    if fixed, this code would still not work as you want, since clients with 1.6.0 or later would sail straight thru and launch.
    I suggest replacing isWebStartInstalled() with deployJava.versionCheck('1.5.0*') .
    then on systems with the plugin installed, if no 1.5.0* version is installed, the latest 1.5.0_XX will be installed before launching the app.
    (assuming the app has also <j2se version=1.5/> or equiv.)
    on systems w/o plugins installed, the latest version of java will be installed, and it will be up to javaws auto download to get 1.5.0* version.
    this could still have problems, especially on platforms not supporting the plugins (non-windows) , since code keeps checking for '1.5.0*', and installing only latest, so you would want to wrap install with something to prevent repeated attempts to install:
    if (deployJava.versionCheck('1.6.0+') && !deployJava.isPluginInstalled()) {
    ---- don't do any install here - ---
    /Andy

  • String alphabetical checking / validation

    Hi
    I am wanting to check that a String is only composed of alphabetical characters or spaces. Is there a nice API in the JDK that I can use to check / validate this String?
    Thanks

    tinny wrote:
    Regular expressions are the nice way to do it.
    The code below will check to see if a String is composed of any combination of alphabetical characters or spaces.
    String str = "Hello from me";
    boolean result = Pattern.matches("[a-zA-Z ]+", str);result =trueNote that the ' ' (single white space) in your "[a-zA-Z ]" will not match tabs or other white space characters. If you also want them to match, you can use:
    "[a-zA-Z\\s]+"
    //   \\s means (almost) any white space character

  • String fomart check

    Hi,
    I have to process a string for a specific format. Basically, need to check if it confirms to the given format.
    The string I usually get is a numeric string. However might get some invalid values.
    Format: "DDD.D" , where D is any digit from [0-9]
    Input is String Output: boolean
    "100.1" ---> true <-----
    "1.123" ---->false
    "-23" ----->false
    "java2" ------>false
    null ------->false
    empty ------->false
    I could check the length to be 4 and then check if dot is present with indexof at position 3 and check each character is a digit in range 0-9.
    Is there any better way to do it? Using Pattern or BigDecimal?
    Kindly suggest.
    Thanks,
    JY

    Thanks paulcw. Thanks for the REGEX suggestion, its way lot better and simpler
    So far, I used this ... pretty inefficient...
    public boolean stringFormatCheck(String guiString) {
             if(guiString == null || guiString.isEmpty() ) return false;
             if(guiString.length()!=5 || guiString.indexOf('.') != 3) return false;
             try {
                    BigDecimal numericString = new BigDecimal(guiString);//digits check
                    return (numericString.scale() !=1)? false:true;
              } catch (NumberFormatException nfe) {
                   return false;
          }

  • Can we get Arraylist from String.Please check the code

    Hi all,
    I have just pasted my code over here.Can anyone of you find the solution for obtaining the Array list from the String.
    For Example :
    ArrayList al = new ArrayList();
    al.add(new byte[2]);
    al.add("2");
    String stringVar = "" + (ArrayList) al;
    Here I can convert the arraylist into string.But can we do he vice versa like obtaining the above arraylist from the string?If please advice me.
    URGENT!!!!

    cudIf you run the code you posted you will observe that the string form of the list does not contain all the information of the list: in particular the array elements are missing. It follows that the "vice versa" conversion you seek is simply not possible.
    A variation on this theme is the following:import java.util.ArrayList;
    public class ListEg {
        public static void main(String[] args) {
            ArrayList al = new ArrayList();
            al.add("foo");
            al.add("bar, baz");
            String stringVar = "" + (ArrayList) al;     
            System.out.println(stringVar);
    }If you think about the output you should be able to conclude that lists with different contents can easily have the same string form.
    Just something to chew on.

  • Like Nodelist, but create temp String for checking

    Hi,
    how do I store the previous contents of the command String in the previousCommand string in the loop so that I can use my method to compare them?
    for ( int i=0; i< totalTstCount; i++){
          for ( int j=0; j< totalTstCount; j++){;
               // store the previous command to comapre TSTs
               String previousCommand = command;
               if ( i == 0) {
                    System.err.println("Issuing first FSI.....");
                    response = sitaIssue.issueFsi(response);
               else if ( (j > 0) && (sitaIssue.isFsiRequired(previousCommand, command))) {                             
                    System.err.println("Issuing another FSI.....");
                    response = sitaIssue.issueFsi(response);
    }

    I don't know where you get command from in the first place, but I understand taht this is not your question. If you declare previousCommand outside the loops and then inside the loop, at the bottom, just before }, assign command to previousCommand (the assignment that is already in your code), then the previous command will be available the next time through the loop. Does this answer your question?

  • Web intalligence string condition checking

    Hi All,
    I am new to SAP BO. i have a requirement like a column has records like valid, SPACES and NULL. if valid i need to display 1, if SPACES or NULL i need to display '0'.
    ex:
    vendor name
    abcd
    xyz
    NULL
    abxy
    expected results:
    vendor name
    format  value
    abcd
    1
    xyz
    1
    0
    NULL
    0
    abxy
    1
    Thanks,
    Poorna

    Hi
    try this
    create a new variable
    format value = =If(([vendor name]="NULL" Or IsNull([vendor name]) Or Length([vendor name])=0);"0";"1")

  • Search string for 3 digit check number?

    For electronic bank statement,uploading file contains 3-digit check number eg;416
    but in FCHI-Check lots we defined six-digit check numbers.
    so system is not able match the check nos. as they are different, and auto reco is not happening.
    we have gone through search strings documentation but
    we dont know what to enter in search strings configuration.
    Kindly help me what to enter for 3 digit check no?
    Edited by: KUMAR on Dec 2, 2008 1:35 PM

    You'll first need to create search strings to "find" the check numbers in the note to payee information.  Then when you set up the search string use, you'll assign a mapping prefix of "000000" to format the check numbers with the leading zeros so they are 6-digits long.
    To set up the search string, you'll need to look at the note to payee information at the text either before or after the check numbers.  Let's say, for example, that the word "CHECK" always preceeds the check numbers in the note to payee:
    CHECK 456
    or
    CHECK 1234
    Because you have some check numbers coming through the bank statement as 3 digits and some as 4 digits, I'm thinking you'll need to set up two search strings, one with search string value "CHECK ###" and the following mapping:
    C ->
    H ->
    E ->
    C ->
    K ->
       ->
    -> #
    -> #
    -> #
    And the second with search string "CHECK ####" and the following mapping:
    C ->
    H ->
    E ->
    C ->
    K ->
       ->
    -> #
    -> #
    -> #
    -> #
    In the search string use, you assign each search string to the relevant company code, house bank and account ID. You can also leave these fields blank, in which case the search strings will be relevant for all company codes, house banks and accounts IDs.  You'll also need to populate the interpretation algorithm with the same algorithm that you assigned in the Global EBS config for the external transaction for checks.  The target field should be Check-/DME Reference-/Assignment number.  Fill in the mapping prefix with 000000 - and be sure to check the Active indicator.  If you are on ECC 6.0, you will also have fields for external transaction and +- (these fields may also be available in ECC 5.0 - but I know they are not available in 4.7 or prior).  If you see these fields, you can fill them in to further limit when the search string is used - for example, only for Negative transactions or only for Negative transactions with a particular external transaction value.
    Let me know if you have any other questions.
    Regards,
    Shannon
    Edited by: Shannon Moberg on Dec 3, 2008 6:05 PM

  • How to set the return language? i read the api already

    import java.io.*;
    import java.util.*;
    class Listing_Available_Locales
         public static void main(String args[])   
             Locale[] locales = Locale.ENGLISH(); //error is here
                             //Locale[] locales = Locale.getAvailableLocales(); //this line no error
             for (int i=0; i<locales.length; i++) {
                 // Get the 2-letter language code
                 String language = locales.getLanguage();
         // Get the 2-letter country code; may be equal to ""
         String country = locales[i].getCountry();
         // Get localized name suitable for display to the user
         String locName = locales[i].getDisplayName();
         System.out.println(language+" "+country+" "+locName);
    local api is like below
    java.util
    Class Locale
    java.lang.Object
    java.util.Locale
    All Implemented Interfaces:
    Cloneable, Serializable
    public final class Locale
    extends Object
    implements Cloneable, Serializable
    A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation--the number should be formatted according to the customs/conventions of the user's native country, region, or culture.
    Create a Locale object using the constructors in this class:
    Locale(String language)
    Locale(String language, String country)
    Locale(String language, String country, String variant)
    The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
    http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
    The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
    http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
    The variant argument is a vendor or browser-specific code. For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most important one first. For example, a Traditional Spanish collation might construct a locale with parameters for language, country and variant as: "es", "ES", "Traditional_WIN".
    Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale. If you want to see whether particular resources are available for the Locale you construct, you must query those resources. For example, ask the NumberFormat for the locales it supports using its getAvailableLocales method.
    Note: When you ask for a resource for a particular locale, you get back the best available match, not necessarily precisely what you asked for. For more information, look at ResourceBundle.
    The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the United States:
    Locale.US
    Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code. You can use getDisplayCountry to get the name of the country suitable for displaying to the user. Similarly, you can use getDisplayLanguage to get the name of the language suitable for displaying to the user. Interestingly, the getDisplayXXX methods are themselves locale-sensitive and have two versions: one that uses the default locale and one that uses the locale specified as an argument.
    The Java 2 platform provides a number of classes that perform locale-sensitive operations. For example, the NumberFormat class formats numbers, currency, or percentages in a locale-sensitive manner. Classes such as NumberFormat have a number of convenience methods for creating a default object of that type. For example, the NumberFormat class provides these three convenience methods for creating a default NumberFormat object:
    NumberFormat.getInstance()
    NumberFormat.getCurrencyInstance()
    NumberFormat.getPercentInstance()
    These methods have two variants; one with an explicit locale and one without; the latter using the default locale.
    NumberFormat.getInstance(myLocale)
    NumberFormat.getCurrencyInstance(myLocale)
    NumberFormat.getPercentInstance(myLocale)
    A Locale is the mechanism for identifying the kind of object (NumberFormat) that you would like to get. The locale is just a mechanism for identifying objects, not a container for the objects themselves.
    Each class that performs locale-sensitive operations allows you to get all the available objects of that type. You can sift through these objects by language, country, or variant, and use the display names to present a menu to the user. For example, you can create a menu of all the collation objects suitable for a given language. Such classes must implement these three class methods:
    public static Locale[] getAvailableLocales()
    public static String getDisplayName(Locale objectLocale,
    Locale displayLocale)
    public static final String getDisplayName(Locale objectLocale)
    // getDisplayName will throw MissingResourceException if the locale
    // is not one of the available locales.
    Since:
    1.1
    See Also:
    ResourceBundle, Format, NumberFormat, Collator, Serialized Form
    Field Summary
    static Locale CANADA
    Useful constant for country.
    static Locale CANADA_FRENCH
    Useful constant for country.
    static Locale CHINA
    Useful constant for country.
    static Locale CHINESE
    Useful constant for language.
    static Locale ENGLISH
    Useful constant for language.
    static Locale FRANCE
    Useful constant for country.
    static Locale FRENCH
    Useful constant for language.
    static Locale GERMAN
    Useful constant for language.
    static Locale GERMANY
    Useful constant for country.
    static Locale ITALIAN
    Useful constant for language.
    static Locale ITALY
    Useful constant for country.
    static Locale JAPAN
    Useful constant for country.
    static Locale JAPANESE
    Useful constant for language.
    static Locale KOREA
    Useful constant for country.
    static Locale KOREAN
    Useful constant for language.
    static Locale PRC
    Useful constant for country.
    static Locale SIMPLIFIED_CHINESE
    Useful constant for language.
    static Locale TAIWAN
    Useful constant for country.
    static Locale TRADITIONAL_CHINESE
    Useful constant for language.
    static Locale UK
    Useful constant for country.
    static Locale US
    Useful constant for country.
    Constructor Summary
    Locale(String language)
    Construct a locale from a language code.
    Locale(String language, String country)
    Construct a locale from language, country.
    Locale(String language, String country, String variant)
    Construct a locale from language, country, variant.
    Method Summary
    Object clone()
    Overrides Cloneable
    boolean equals(Object obj)
    Returns true if this Locale is equal to another object.
    static Locale[] getAvailableLocales()
    Returns a list of all installed locales.
    String getCountry()
    Returns the country/region code for this locale, which will either be the empty string or an upercase ISO 3166 2-letter code.
    static Locale getDefault()
    Gets the current value of the default locale for this instance of the Java Virtual Machine.
    String getDisplayCountry()
    Returns a name for the locale's country that is appropriate for display to the user.
    String getDisplayCountry(Locale inLocale)
    Returns a name for the locale's country that is appropriate for display to the user.
    String getDisplayLanguage()
    Returns a name for the locale's language that is appropriate for display to the user.
    String getDisplayLanguage(Locale inLocale)
    Returns a name for the locale's language that is appropriate for display to the user.
    String getDisplayName()
    Returns a name for the locale that is appropriate for display to the user.
    String getDisplayName(Locale inLocale)
    Returns a name for the locale that is appropriate for display to the user.
    String getDisplayVariant()
    Returns a name for the locale's variant code that is appropriate for display to the user.
    String getDisplayVariant(Locale inLocale)
    Returns a name for the locale's variant code that is appropriate for display to the user.
    String getISO3Country()
    Returns a three-letter abbreviation for this locale's country.
    String getISO3Language()
    Returns a three-letter abbreviation for this locale's language.
    static String[] getISOCountries()
    Returns a list of all 2-letter country codes defined in ISO 3166.
    static String[] getISOLanguages()
    Returns a list of all 2-letter language codes defined in ISO 639.
    String getLanguage()
    Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
    String getVariant()
    Returns the variant code for this locale.
    int hashCode()
    Override hashCode.
    static void setDefault(Locale newLocale)
    Sets the default locale for this instance of the Java Virtual Machine.
    String toString()
    Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars.
    Methods inherited from class java.lang.Object
    finalize, getClass, notify, notifyAll, wait, wait, wait
    Field Detail
    ENGLISH
    public static final Locale ENGLISHUseful constant for language.
    FRENCH
    public static final Locale FRENCHUseful constant for language.
    GERMAN
    public static final Locale GERMANUseful constant for language.
    ITALIAN
    public static final Locale ITALIANUseful constant for language.
    JAPANESE
    public static final Locale JAPANESEUseful constant for language.
    KOREAN
    public static final Locale KOREANUseful constant for language.
    CHINESE
    public static final Locale CHINESEUseful constant for language.
    SIMPLIFIED_CHINESE
    public static final Locale SIMPLIFIED_CHINESEUseful constant for language.
    TRADITIONAL_CHINESE
    public static final Locale TRADITIONAL_CHINESEUseful constant for language.
    FRANCE
    public static final Locale FRANCEUseful constant for country.
    GERMANY
    public static final Locale GERMANYUseful constant for country.
    ITALY
    public static final Locale ITALYUseful constant for country.
    JAPAN
    public static final Locale JAPANUseful constant for country.
    KOREA
    public static final Locale KOREAUseful constant for country.
    CHINA
    public static final Locale CHINAUseful constant for country.
    PRC
    public static final Locale PRCUseful constant for country.
    TAIWAN
    public static final Locale TAIWANUseful constant for country.
    UK
    public static final Locale UKUseful constant for country.
    US
    public static final Locale USUseful constant for country.
    CANADA
    public static final Locale CANADAUseful constant for country.
    CANADA_FRENCH
    public static final Locale CANADA_FRENCHUseful constant for country.
    Constructor Detail
    Locale
    public Locale(String language,
    String country,
    String variant)Construct a locale from language, country, variant. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
    Parameters:
    language - lowercase two-letter ISO-639 code.
    country - uppercase two-letter ISO-3166 code.
    variant - vendor and browser specific code. See class description.
    Throws:
    NullPointerException - thrown if any argument is null.
    Locale
    public Locale(String language,
    String country)Construct a locale from language, country. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
    Parameters:
    language - lowercase two-letter ISO-639 code.
    country - uppercase two-letter ISO-3166 code.
    Throws:
    NullPointerException - thrown if either argument is null.
    Locale
    public Locale(String language)Construct a locale from a language code. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
    Parameters:
    language - lowercase two-letter ISO-639 code.
    Throws:
    NullPointerException - thrown if argument is null.
    Since:
    1.4
    Method Detail
    getDefault
    public static Locale getDefault()Gets the current value of the default locale for this instance of the Java Virtual Machine.
    The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified. It can be changed using the setDefault method.
    Returns:
    the default locale for this instance of the Java Virtual Machine
    setDefault
    public static void setDefault(Locale newLocale)Sets the default locale for this instance of the Java Virtual Machine. This does not affect the host locale.
    If there is a security manager, its checkPermission method is called with a PropertyPermission("user.language", "write") permission before the default locale is changed.
    The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified.
    Since changing the default locale may affect many different areas of functionality, this method should only be used if the caller is prepared to reinitialize locale-sensitive code running within the same Java Virtual Machine, such as the user interface.
    Parameters:
    newLocale - the new default locale
    Throws:
    SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
    NullPointerException - if newLocale is null
    See Also:
    SecurityManager.checkPermission(java.security.Permission), PropertyPermission
    getAvailableLocales
    public static Locale[] getAvailableLocales()Returns a list of all installed locales.
    getISOCountries
    public static String[] getISOCountries()Returns a list of all 2-letter country codes defined in ISO 3166. Can be used to create Locales.
    getISOLanguages
    public static String[] getISOLanguages()Returns a list of all 2-letter language codes defined in ISO 639. Can be used to create Locales. [NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. The list this function returns includes both the new and the old codes for the languages whose codes have changed.]
    getLanguage
    public String getLanguage()Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
    NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. Locale's constructor recognizes both the new and the old codes for the languages whose codes have changed, but this function always returns the old code. If you want to check for a specific language whose code has changed, don't do
    if (locale.getLanguage().equals("he")
    Instead, do
    if (locale.getLanguage().equals(new Locale("he", "", "").getLanguage())
    See Also:
    getDisplayLanguage()
    getCountry
    public String getCountry()Returns the country/region code for this locale, which will either be the empty string or an upercase ISO 3166 2-letter code.
    See Also:
    getDisplayCountry()
    getVariant
    public String getVariant()Returns the variant code for this locale.
    See Also:
    getDisplayVariant()
    toString
    public final String toString()Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars. Language is always lower case, and country is always upper case. If the language is missing, the string will begin with an underbar. If both the language and country fields are missing, this function will return the empty string, even if the variant field is filled in (you can't have a locale with just a variant-- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
    Overrides:
    toString in class Object
    Returns:
    a string representation of the object.
    See Also:
    getDisplayName()
    getISO3Language
    public String getISO3Language()
    throws MissingResourceExceptionReturns a three-letter abbreviation for this locale's language. If the locale doesn't specify a language, this will be the empty string. Otherwise, this will be a lowercase ISO 639-2/T language code. The ISO 639-2 language codes can be found on-line at ftp://dkuug.dk/i18n/iso-639-2.txt
    Throws:
    MissingResourceException - Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.
    getISO3Country
    public String getISO3Country()
    throws MissingResourceExceptionReturns a three-letter abbreviation for this locale's country. If the locale doesn't specify a country, this will be tbe the empty string. Otherwise, this will be an uppercase ISO 3166 3-letter country code.
    Throws:
    MissingResourceException - Throws MissingResourceException if the three-letter country abbreviation is not available for this locale.
    getDisplayLanguage
    public final String getDisplayLanguage()Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatian), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
    getDisplayLanguage
    public String getDisplayLanguage(Locale inLocale)Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized according to inLocale, (say, we don't have a Japanese name for Croatian), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
    getDisplayCountry
    public final String getDisplayCountry()Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatia), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
    getDisplayCountry
    public String getDisplayCountry(Locale inLocale)Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized according to inLocale. (say, we don't have a Japanese name for Croatia), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
    getDisplayVariant
    public final String getDisplayVariant()Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for the default locale. If the locale doesn't specify a variant code, this function returns the empty string.
    getDisplayVariant
    public String getDisplayVariant(Locale inLocale)Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for inLocale. If the locale doesn't specify a variant code, this function returns the empty string.
    getDisplayName
    public final String getDisplayName()Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:
    language (country, variant)
    language (country)
    language (variant)
    country (variant)
    language
    country
    variant
    depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
    getDisplayName
    public String getDisplayName(Locale inLocale)Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:
    language (country, variant)
    language (country)
    language (variant)
    country (variant)
    language
    country
    variant
    depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
    clone
    public Object clone()Overrides Cloneable
    Overrides:
    clone in class Object
    Returns:
    a clone of this instance.
    See Also:
    Cloneable
    hashCode
    public int hashCode()Override hashCode. Since Locales are often used in hashtables, caches the value for speed.
    Overrides:
    hashCode in class Object
    Returns:
    a hash code value for this object.
    See Also:
    Object.equals(java.lang.Object), Hashtable
    equals
    public boolean equals(Object obj)Returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, country, and variant, and unequal to all other objects.
    Overrides:
    equals in class Object
    Parameters:
    obj - the reference object with which to compare.
    Returns:
    true if this Locale is equal to the specified object.
    See Also:
    Object.hashCode(), Hashtable
    Overview Package Class Use Tree Deprecated Index Help
    JavaTM 2 Platform
    Std. Ed. v1.4.2
    PREV CLASS NEXT CLASS FRAMES NO FRAMES
    SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
    Submit a bug or feature
    For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

    Was it really necessary to post the whole API description?!?
    Locale[] locales = Locale.ENGLISH();ENGLISH is not a method in class Locale, so do not add the braces "( );".
    Also, the constant ENGLISH is not an array, but just a single Locale object.
    You didn't say what your problem was. What do you want to achieve with your program and what is it that you don't understand?

  • Is there Java support for Indian languages other than Hindi?

    I'd like to use Tamil as a test language for some translated java files.
    I don't know whether it is supported or not.
    Alternatives are Bangla, Gujararati, Kannada, Marathi, Oriya, Punjabi, Telugu. Are any of these supported?
    I'd prefer not to use Hindi.
    The only website I can find listing the languages supported is from 2003. If you have a link to a more recent one, I would appreciate it.

    Locale is basically a glorified String[], so the idea that some locales are supported and others are not is sort of illusory.
    Quoting from the API...
    [quote begins]
    Locale(String language, String country, String variant)
    The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639... The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166...
    Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale...
    The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales...
    A Locale is the mechanism for identifying the kind of object (NumberFormat) that you would like to get. The locale is just a mechanism for identifying objects, not a container for the objects themselves.
    [quote ends]
    In other words, if you wanted to make up your own local for the language that they speak on Planet X (Xian), you could perfectly well have a Local object for that and properties or list files for it.
    Drake

  • Wron number of arguments error on URLEncoder.encode(language,

    the following is the code which is an example in The complete Reference JSP
    I ran this in tomcat
    it shows an error which is showed down this code.The place where error occuring is underlined in the code
    <%@ page session="false"
    import="java.io.*,
    java.net.*,
    java.util.*" %>
    <html>
    <head>
    <title>Using Cookies to Store Preferences</title>
    <style><%= STYLESHEET %></style>
    </head>
    <body>
    <table border="0" cellspacing="3" width="500">
    <%-- Company logo --%>
    <tr><td>
    <img src="images/lyric_note.png">
    </td></tr>
    <%-- Language preference bar --%>
    <tr><td class="LB">
    <%= getLanguageBar(request) %>
    </td></tr>
    </table>
    <%-- Localized greeting --%>
    <h1><%= getGreeting(request) %></h1>
    <%-- Store language preference in a persistent cookie --%>
    <% storeLanguagePreferenceCookie(request, response); %>
    </body>
    </html>
    <%!
    // ===========================================
    // Helper methods included here for
    // clarity. A better choice would be
    // to put them in beans or a servlet.
    // ===========================================
    * The CSS stylesheet
    private static final String STYLESHEET =
    "h1 { font-size: 130%; }\n"
    + ".LB {\n"
    + " background-color: #005A9C;\n"
    + " color: #FFFFFF;\n"
    + " font-size: 90%;\n"
    + " font-weight: bold;\n"
    + " padding: 0.5em;\n"
    + " text-align: right;\n"
    + " word-spacing: 1em;\n"
    + "}\n"
    + ".LB a:link, .LB a:active, .LB a:visited {\n"
    + " text-decoration: none;\n"
    + " color: #FFFFFF;\n"
    + "}\n";
    * Creates the language preference bar
    private String getLanguageBar
    (HttpServletRequest request)
    throws IOException
    String thisURL = request.getRequestURL().toString();
    StringBuffer sb = new StringBuffer();
    appendLink(sb, thisURL, Locale.ENGLISH);
    appendLink(sb, thisURL, Locale.GERMAN);
    appendLink(sb, thisURL, Locale.FRENCH);
    appendLink(sb, thisURL, Locale.ITALIAN);
    String languageBar = sb.toString();
    return languageBar;
    * Helper method to create hyperlinks
    private void appendLink
    (StringBuffer sb, String thisURL, Locale locale)
    throws UnsupportedEncodingException
    if (sb.length() > 0)
    sb.append(" ");
    String language = locale.getLanguage();
    sb.append("<a href=\"");
    sb.append(thisURL);
    sb.append("?language=");
    sb.append(URLEncoder.encode(language, "UTF-8")); sb.append("\">");
    sb.append(locale.getDisplayName(locale));
    sb.append("</a>\n");
    * Gets the greeting message appropriate for
    * this locale
    private String getGreeting
    (HttpServletRequest request)
    Locale locale = getLocaleFromCookie(request);
    ResourceBundle RB = ResourceBundle.getBundle
    ("com.jspcr.sessions.welcome", locale);
    String greeting = RB.getString("greeting");
    return greeting;
    * Determines the locale to use, in the following
    * order of preference:
    * 1. Language parameter passed with request
    * 2. Language cookie previously stored
    * 3. Default locale for client
    * 4. Default locale for server
    private Locale getLocaleFromCookie
    (HttpServletRequest request)
    Locale locale = null;
    String language = request.getParameter("language");
    if (language != null)
    locale = new Locale(language);
    else {
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
    for (int i = 0; i < cookies.length; i++) {
    Cookie cookie = cookies;
    String name = cookie.getName();
    if (name.equals("language")) {
    language = cookie.getValue();
    locale = new Locale(language);
    break;
    if (locale == null)
    locale = request.getLocale();
    return locale;
    * Stores the language preference
    * in a persistent cookie
    private void storeLanguagePreferenceCookie
    (HttpServletRequest request, HttpServletResponse response)
    Locale locale = getLocaleFromCookie(request);
    String name = "language";
    String value = locale.getLanguage();
    Cookie cookie = new Cookie(name, value);
    final int ONE_YEAR = 60 * 60 * 24 * 365;
    cookie.setMaxAge(ONE_YEAR);
    response.addCookie(cookie);
    %>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occured between lines: 45 and 173 in the jsp file: /chap08/examples/cookies/CookieBasedWelcome.jsp
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\_\chap08\examples\cookies\CookieBasedWelcome$jsp.java:75: Wrong number of arguments in method.
    sb.append(URLEncoder.encode(language, "UTF-8"));
    ^
    An error occured between lines: 45 and 173 in the jsp file: /chap08/examples/cookies/CookieBasedWelcome.jsp
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\_\chap08\examples\cookies\CookieBasedWelcome$jsp.java:110: Wrong number of arguments in constructor.
    locale = new Locale(language);
    ^
    An error occured between lines: 45 and 173 in the jsp file: /chap08/examples/cookies/CookieBasedWelcome.jsp
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\_\chap08\examples\cookies\CookieBasedWelcome$jsp.java:119: Wrong number of arguments in constructor.
    locale = new Locale(language);
    ^
    3 errors
    But i have even checked the syntax of encode at which is exactly matching
    http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLEncoder.html
    Kindly let me know what is the reason.......

    Check the Java API for this:
    There is a specific note for the method, which reads as follows:
    Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.
    It's always better to look in API docs.
    Annie.

  • From MD5-string to byte array

    Hi fellows, I'm writing a simple cracker for MD5. The hash value has to be passed at command line as argument.
    e.g.
    java Cracker 0cc175b9c0f1b6a831c399e269772661In order to decode the hash value I'm using a brute force approach: therefore I compare a series of strings with the hash value by using the method of the class MessageDigest isEqual(byte[] a, byte[] b). So I encode each string and compare the byte array I get with the byte array of the hash value.
    Here it comes the trouble I'm in:
    when I try to get a bytes array of the MD5 hash value passed as argument of the program , I do get something, but it's not something that the isEqual method of MessageDigest can use to compare. As a result any attempt during the execution of brute force fails, even though the key is one of the string being checked.
    Perhaps am I facing a format problem? Any idea?
    Sorry for my english, it's not my first language
    Thanks to whoever will help

    Almost all questions in these forums about brute force attack on MD5 (or SHA1 or SHA256 etc etc etc) are school, college or university projects and of no practical use. This is almost certainly such a project.
    Unless things have changed in the last year, there is no practical brute force attack on MD5 whereby an input can be generated from an arbitrary output even though two inputs with the same output can be fabricated. A dictionary attack is feasible if no salt is used or a known salt is used since one only has to build the dictionary for one salt value. If a different salt is used for each entry being attacked then a dictionary will be need for each salt being used. Of course if one takes the simple precaution of not using anything that is likely to be in a dictionary then the dictionary attack will likely fail.

  • Portal Language through code

    Hi,
    I currently have the following code to check the language of a user within Portal, but when the user has no language populated I would like to set this to a default.  How can I check the value as when I have coded this before this has errored.
    IUser me = request.getUser();
    String language = "en";
    Locale myLocale = me.getLocale();
    language = myLocale.getLanguage();
    try {
    IUserMaint modUser = userFact.getMutableUser(me.getUid());
    if (language.equalsIgnoreCase(""))
         modUser.setLocale(Locale.UK);
    if (language.equalsIgnoreCase("english"))
         modUser.setLocale(Locale.UK);
    if (language.equalsIgnoreCase("italian"))
         modUser.setLocale(Locale.ITALIAN);
    if (language.equalsIgnoreCase("german"))
         modUser.setLocale(Locale.GERMAN);
    modUser.commit();
    modUser.save();
    catch (Exception e) {
         response.write("<br>Problem setting language: "+e.getMessage());
         oksofar = false;
    Any help would gratefully appreciated.

    Hi Kai,
    > when I have coded this before this has errored
    Are you talking about the code snippet given? If yes, what kind of error?!?!
    > when the user has no language populated I would like to set this to a default
    If that what you want to try with the code snippet given? The snippet is (a) wrong and (b) strange:
    a) Wrong. locale.getLanguage never returns "english" or "italian" or "geman"; it returns the language code (a lowercase ISO 639 code).
    b) Strange. You want to check if it is set to "german" and then you set it to german?! Don't understand your logic...
    You should also call save() first and then commit(); see http://help.sap.com/javadocs/nw04s/current/se/com/sap/security/api/IPrincipalMaint.html#save()
    Also, keep in mind that you cannot change the locale of a user if this attribute would be mapped to some LDAP attribute and if the LDAP is connected read-only.
    Hope it helps
    Detlev

Maybe you are looking for

  • Can not start mysql server

    I recently installed mysql server on my mac os 10.6.8, earlier i had installed XAMPP on my machine but i have uninstalled it(deleted it & ran few commands in terminal), but now when i try to start server from preference pane it doesn't start & not fr

  • Surcharge to be post using two deferent GL accounts

    Hi Guys, I have customer requirement to post a surcharge using of two G/L accounts for each line item, Say Exu2026 Surcharge item condition ZTM1 have value Rs 1000/- need to post two G/L account same amount with out change 1) 2000014141 2) 7000014141

  • "Error opening file" - H.264 .MOV from Canon DSLR won't load.

    Hello! I've had success with Speedgrade, before a recent reformat of my system. I shot some test video on my Canon T3i, which records H.264 .MOV at 1920x1080 23.976 frames per second. I have Quicktime 7 installed. Somehow I get this error. Please hel

  • Wrong photo

    If I send a text message to an iphone a photo of my husband comes up instead of me. Can someone tell me how to change this. He has never used my iphone so can't work this one out either.

  • Digitizing mass quantities of photos

    I have a couple thousand 4x6 photos (I also have the corresponding negatives) that I want to digitize, organize in iPhoto and eventually archive to DVD. I have a flatbed scanner, but scanning the photos is slow and tedious (rotate, crop, adjust level