check if a string contains only some characters

I'm working on a java program that converts the Roman numbers. The user enters a string, and I need to check to make sure that it contains MDCLXVI and if he doesn't I will get them the input again string. I thought I'd do a while loop but I'm not sure if it's the smart way to make or the syntax to perform the check.

Here was a thought on the control with a while loop, but I've never used it before and maybe build evil.
while (!Pattern.matches("MDCLXVI", firstRoman))
        {
        System.out.print("Not a valid Roman Number please try again");
        firstRoman = firstRoman.toUpperCase();
        }
My Code is as follows:
// Ask for user to input firstRoman Number
        System.out.print("Enter your first Roman Number:");
        // add the Roman Number to the String variable
        firstRoman = keyboard.nextLine();
        firstRoman = firstRoman.toUpperCase();
Once they enter in the it, I want to check to make sure that it has characters MDCLXVI and if it contains any other characters then I will provide a new object Scanner keyboard to try again and if it fails again, it will go to the option to try again until they put in a string that contains only the characters above. I don't know where to go here to get the while loop has worked. New to Java and I got my program work properly when I put good known numbers of novel, but I want to take incorrect entries.

Any help would be appreciated.

Thank you
Wally

I put the code for my main program and my class below just in case. I have already met the requirements of the teacher if the project is done, I'm just trying to improve.
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myname.project.pkg6;

import java.util.Scanner;
import java.util.regex.Pattern;

/**
 *
 * @author wsteadma
 */
public class mynameProject6 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        // Used for testing
        String firstRoman;
        String secondRoman;
        
        
        Scanner keyboard = new Scanner(System.in);

        
        // Ask for user to input firstRoman Number
        System.out.print("Enter your first Roman Number:");
        // add the Roman Number to the String variable
        firstRoman = keyboard.nextLine();
        firstRoman = firstRoman.toUpperCase();
        
              
        // Ask for user to input secondRoman Number
        System.out.print("Enter your second Roman Number:");
        // add the Roman Number to the String variable
        secondRoman = keyboard.nextLine(); // Add the name input into the name variable
        secondRoman = secondRoman.toUpperCase();
        
        
        //Creating first instance of Roman Numbers class
        Roman firstNumber = new Roman(firstRoman);
        Roman secondNumber = new Roman(secondRoman);
        
        System.out.println("Printout of the created roman numbers");
        //Prints out the Roman Number
        firstNumber.printRoman();
        secondNumber.printRoman();
        
        
        // Convert Roman to Decimal
        firstNumber.setDecimal(firstRoman);
        secondNumber.setDecimal(secondRoman);
        
        System.out.println("Viewing the Decimal values for the two defined instances");
        //Prints decimal Numbers
        firstNumber.printDecimal();  
        secondNumber.printDecimal();
        
        System.out.println("Adding the Roman Numbers and returning new Roman value");
        Roman romanAdd;
        romanAdd = firstNumber.addRoman(secondNumber);
        romanAdd.printRoman();

        System.out.println("Subtracting the Roman Numbers and return new Roman value");
        Roman romanSub;
        romanSub = firstNumber.subRoman(secondNumber);
        romanSub.printRoman();
    }
}
CLASS:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myname.project.pkg6;

/**
 *
 * @author wsteadma
 */
public class Roman {

    private String romNumber;
    private int decNumber;

    public Roman(String rNumber) {
        romNumber = rNumber;
    }

    public String getRoman() {
        return romNumber;
    }
    
    public int getDecimal()
    {
    return decNumber;
    }

    public void printRoman() {
        System.out.println("The Roman Number is " + romNumber);
    }

    public void printDecimal() {
        System.out.println("The Decimal Number is " + decNumber);
    }

    // Converts a roman number string into a decimal value
    public int setDecimal(String romNum) {
        int charValue = 0;
        char[] characters = new char[romNum.length()];

        //System.out.println("romNum length is " + romNum.length());
        for (int counter = 0; counter < romNum.length(); counter++) {
            characters[counter] = romNum.charAt(counter);
            //System.out.println(characters[counter]);
        }

        for (int sCounter = 0; sCounter < romNum.length(); sCounter++) {
            if (characters[sCounter] == 'M'  || characters[sCounter] == 'm') {
                charValue += 1000;
            } else if (characters[sCounter] == 'D' || characters[sCounter] == 'd') {
                charValue += 500;
            } else if (characters[sCounter] == 'C' || characters[sCounter] == 'c') {
                charValue += 100;
            } else if (characters[sCounter] == 'L' || characters[sCounter] == 'l') {
                charValue += 50;
            } else if (characters[sCounter] == 'X' || characters[sCounter] == 'x') {
                charValue += 10;
            } else if (characters[sCounter] == 'V' || characters[sCounter] == 'v') {
                charValue += 5;
            } else if (characters[sCounter] == 'I' || characters[sCounter] == 'i') {
                charValue += 1;
            }
        
        }
        decNumber = charValue;
        return charValue;
    }

    // Converts a decomal number to a roman number
    public String setDec2Roman(int decNum) {
        String newRoman = "";

        while (decNum >= 1000) {
            newRoman += "M";
            decNum -= 1000;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum >= 500) {
            newRoman += "D";
            decNum -= 500;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum >= 100) {
            newRoman += "C";
            decNum -= 100;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum >= 50) {
            newRoman += "L";
            decNum -= 50;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum >= 10) {
            newRoman += "X";
            decNum -= 10;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum >= 5) {
            newRoman += "V";
            decNum -= 5;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }

        while (decNum > 0) {
            newRoman += "I";
            decNum -= 1;
            //System.out.println(decNum);
            //System.out.println(newRoman);
        }
        return newRoman;
    }

    public Roman addRoman(Roman newRom) {
        int totRom = newRom.setDecimal(newRom.romNumber) + decNumber;
        romNumber = newRom.setDec2Roman(totRom);
        return new Roman(romNumber);
    }
    
    public Roman subRoman(Roman subRom) {
        int totRom = decNumber - subRom.setDecimal(subRom.romNumber);
        romNumber = subRom.setDec2Roman(totRom);
        return new Roman(romNumber);
    }
    
}

While (!.) Pattern.Matches ("MDCLXVI", firstRoman))

Try "[MDCLXVI] *" and see if it's better

{
System.out.Print ("a valid Roman Number please try again");
firstRoman = firstRoman.toUpperCase ();
}

My Code is as follows:

// Ask for user to input firstRoman Number
System.out.print("Enter your first Roman Number:");
// add the Roman Number to the String variable
firstRoman = keyboard.nextLine();
firstRoman = firstRoman.toUpperCase();

Once they enter in the it, I want to check to make sure that it has characters MDCLXVI and if it contains any other characters then I will provide a new object Scanner keyboard to try again and if it fails again, it will go to the option to try again until they put in a string that contains only the characters above. I don't know where to go here to get the while loop has worked. New to Java and I got my program work properly when I put good known numbers of novel, but I want to take incorrect entries.

Any help would be appreciated.

Thank you
Wally

I put the code for my main program and my class below just in case. I have already met the requirements of the teacher if the project is done, I'm just trying to improve.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package myname.project.pkg6;

import java.util.Scanner;
import java.util.regex.Pattern;

/**
*
* @author wsteadma
*/
public class mynameProject6 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

// Used for testing
String firstRoman;
String secondRoman;

Scanner keyboard = new Scanner(System.in);

// Ask for user to input firstRoman Number
System.out.print("Enter your first Roman Number:");
// add the Roman Number to the String variable
firstRoman = keyboard.nextLine();
firstRoman = firstRoman.toUpperCase();

// Ask for user to input secondRoman Number
System.out.print("Enter your second Roman Number:");
// add the Roman Number to the String variable
secondRoman = keyboard.nextLine(); // Add the name input into the name variable
secondRoman = secondRoman.toUpperCase();

//Creating first instance of Roman Numbers class
Roman firstNumber = new Roman(firstRoman);
Roman secondNumber = new Roman(secondRoman);

System.out.println("Printout of the created roman numbers");
//Prints out the Roman Number
firstNumber.printRoman();
secondNumber.printRoman();

// Convert Roman to Decimal
firstNumber.setDecimal(firstRoman);
secondNumber.setDecimal(secondRoman);

System.out.println("Viewing the Decimal values for the two defined instances");
//Prints decimal Numbers
firstNumber.printDecimal();
secondNumber.printDecimal();

System.out.println("Adding the Roman Numbers and returning new Roman value");
Roman romanAdd;
romanAdd = firstNumber.addRoman(secondNumber);
romanAdd.printRoman();

System.out.println("Subtracting the Roman Numbers and return new Roman value");
Roman romanSub;
romanSub = firstNumber.subRoman(secondNumber);
romanSub.printRoman();
}
}

CLASS:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package myname.project.pkg6;

/**
*
* @author wsteadma
*/
public class Roman {

private String romNumber;
private int decNumber;

public Roman(String rNumber) {
romNumber = rNumber;
}

public String getRoman() {
return romNumber;
}

public int getDecimal()
{
return decNumber;
}

public void printRoman() {
System.out.println("The Roman Number is " + romNumber);
}

public void printDecimal() {
System.out.println("The Decimal Number is " + decNumber);
}

// Converts a roman number string into a decimal value
public int setDecimal(String romNum) {
int charValue = 0;
char[] characters = new char[romNum.length()];

//System.out.println("romNum length is " + romNum.length());
for (int counter = 0; counter < romNum.length(); counter++) {
characters[counter] = romNum.charAt(counter);
//System.out.println(characters[counter]);
}

for (int sCounter = 0; sCounter < romNum.length(); sCounter++) {
if (characters[sCounter] == 'M'  || characters[sCounter] == 'm') {
charValue += 1000;
} else if (characters[sCounter] == 'D' || characters[sCounter] == 'd') {
charValue += 500;
} else if (characters[sCounter] == 'C' || characters[sCounter] == 'c') {
charValue += 100;
} else if (characters[sCounter] == 'L' || characters[sCounter] == 'l') {
charValue += 50;
} else if (characters[sCounter] == 'X' || characters[sCounter] == 'x') {
charValue += 10;
} else if (characters[sCounter] == 'V' || characters[sCounter] == 'v') {
charValue += 5;
} else if (characters[sCounter] == 'I' || characters[sCounter] == 'i') {
charValue += 1;
}

}
decNumber = charValue;
return charValue;
}

// Converts a decomal number to a roman number
public String setDec2Roman(int decNum) {
String newRoman = "";

while (decNum >= 1000) {
newRoman += "M";
decNum -= 1000;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum >= 500) {
newRoman += "D";
decNum -= 500;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum >= 100) {
newRoman += "C";
decNum -= 100;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum >= 50) {
newRoman += "L";
decNum -= 50;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum >= 10) {
newRoman += "X";
decNum -= 10;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum >= 5) {
newRoman += "V";
decNum -= 5;
//System.out.println(decNum);
//System.out.println(newRoman);
}

while (decNum > 0) {
newRoman += "I";
decNum -= 1;
//System.out.println(decNum);
//System.out.println(newRoman);
}
return newRoman;
}

public Roman addRoman(Roman newRom) {
int totRom = newRom.setDecimal(newRom.romNumber) + decNumber;
romNumber = newRom.setDec2Roman(totRom);
return new Roman(romNumber);
}

public Roman subRoman(Roman subRom) {
int totRom = decNumber - subRom.setDecimal(subRom.romNumber);
romNumber = subRom.setDec2Roman(totRom);
return new Roman(romNumber);
}

}

Tags: Java

Similar Questions

  • Check that a string contains data only numbers

    Hello

    I'm trying to find an elegant way to test an input string "serial number" format A00000000 (where A can be any letter and 0 can be a number any).  My first thought was to check the following features:

    (1) total string length = 9.

    (2) using the "Decimal String to the Number.vi", result = 0 (which indicates that the string contains no numbers).

    (3) using the 'Decimal string to Number.vi' with an offset of 1, the result is a number.

    Unfortunately, that does not differentiate between the following strings:

    A00005123 valid

    Invalid A5123

    Invalid A5123B123

    Invalid A005123BC

    All the world is this recently?  Is there a way to analyze non-specific chips (for example separating the groups of letters, numbers or other?)  Is there a complete way to do this without breaking the chain in 9 individual items and do a comparison of 26 item for the letter and 10 element for each number comparisons?

    Thank you

    Sean

    You can use a regular expression to match the pattern.

  • Check if a string contains "text" in a box, and only if it does not, add it to the chain.

    I have some comboboxes. I want a text field to add a channel to itself, that contains the text selected in each combobox. I got it with this:

    var a = this.getField ("CoBi_text");

    for (i = 1; i < 16; i ++) {}

    var t = (this.getField("CoB_"+i).valueAsString);

    Si (t ! = « ») {}

    a.Value += t + ',';   }   }

    But what adds text even though I select the same option in any of the combobox control. How can I include a conditional don't skip the increment if "the text is already in the string?  I tried this:

    If ((t! = «») & & (a.value.indexOf ("t") < 0)) {}

    a.Value += t + ',' ;}

    But it causes the chain add the text first, don't increment not any text more after that.

    PS. This text field will be hidden and later used on another condition (if it contains 'a specific text'), some other triggering actions.
    So the ',' (comma) is probably not necessary, but I think that it should not be in the way of a proper search indexOf (right?)

    Thank you.

    eHRM, nevermind. I got it.

    the "t" inside indexOf should not "s...".

    var a = this.getField ("CoBi_text");

    for (i = 1; i<16;i++)>

    var t = (this.getField("CoB_"+i).valueAsString);

    If ((t! = «») & (a.value.indexOf (t))<0) )="">

    a.Value += t + ',' ;}

    Now, he adds "text", but not more than once for each different text on each drop-down list.

    There is always the question of the modification of a selected item in a combobox control, how do I remove the old text from the text box but I think than any forced recalculation should be enough.

    Thank you for taking the time to respond and for the link!

  • extract only some characters of a coloumn

    the chain of value in coloumn ERROR_ROW (the field name is ERROR_ROW)

    Salesperson code: RFD, product code: GLU 065405: BT, date of invoice: 16 March 09, the invoice No.: 41001418, quantity: 3, price: 13.49, amount: 40.47, distributor HIN: G74LA4Q00, HIN client: AHW6WQF00, Source: SS, REF ID from: 35950268, HIN warehouses: KE12PF500, Trans line no: 4436, Bill: 211907, ship to: AHW6WQF00, identifier of sales: 21, Zip: 45133

    I have a thousand rows in this table

    Using SQL

    I want to extract the values of the XXXXXXX (abouve example 41001418)
    in the example charactors between invoice No.: XXXXXXX, * amount *.

    These characters between "Invoice number" and "Quantity" must be extracted from all lines

    Note: the value of
    vendor code
    product code
    UNIT OF MEASURE
    Its value will vary

    Thanks in advance
    MAh

    NOT TESTED

    substr(error_row,
           instr(error_row,'Invoice no:') + 12,
           instr(error_row,',',instr(error_row,'Invoice no:'),1) - instr(error_row,'Invoice no:') - 12)
          ) 
    

    Concerning

    Etbin

    Assume that "quantity:' does not always follow ' invoice No. :'-> looking for the first comma after" invoice No.:'

    Edited by: Etbin on 26.6.2009 18:07

  • 4.0EA1 - connection name can contain only alphanumeric... why?

    I just encountered this error, which is apparently design:

    Connection name can contain only alphanumeric characters, the underscore (_) and hyphen (-).

    I found this post on the forum, but was a little depressed that I never use login names are now disabled... and as I had to change one of them, I need now to change my entire naming system:

    Restriction of SQL Developer 3.2.1 patch connection name

    Exclusion of character list may or may not vary by operating system, and, roughly speaking, will probably contain...

    <:/\|?*()%&'$@^~#"> {code} 

    Can we reconsider a return to how it used to be for 4.0EA2?  I use various constructs to ensure an appropriate message is carried with the connection everywhere it goes:


    # ATTENTION #-Production


    Now I need to come up with a new naming system... <sigh>


    Greg.

    Why - I don't know there is anything that we can say that will make you happy here, but change has been to examine a few bugs of low level framework.

    You can keep your old login names. As a solution, just manually change connections with SQL Developer XML file closed.

  • Check the string only Alpha characters

    Is there a function in ColdFusion that will check that a string of alpha only characters (not digital or for example &, $, etc.)? I try to avoid creating a string of alpha characters or all all nonalphanumeric characters to loop on and the text is authoritative.

    Which could easily be done with a regular expression using REFIND() function search.

    Something like that on the top of my head and untested example.  REFIND("[^A-Za-z]",yourStringVar).  If that returns true then we characters other characters then alpha in the chain.

  • Test whether the string contains the only slash the other way around?

    Hello

    How do you do that?

    I need to check if

    (a) the string contains two consecutive backslashes

    (b), if not, check if there is at least an oblique bar opposite

    If (test.) IndexOf("\\") > = 0) seems to knock on a string that is 'ss\\ss', but I have a feeling that is incorrect. I think it's really just test for 1 backslash.

    AS3 and don't let you do if (test.indexOf("\") > = 0), as the single backslash escapes the rest of your code.

    It is to test for the existence of a or two backslashes in the ID3 tags, as some editors use as a delimiter for multiple tags within the category of a tag for example kind: rock\\pop, or rock\pop

    Thanks for taking a peek.

    {if(s.IndexOf("\\\")>-1})

    There are two or more backslashes consecutive

    } else {if(s.indexOf("\\")>-1)

    There is that a single backslash

    }

  • validation to check him point does not contain any special characters except ' - '.

    Hi all

    I have a question and the need to create a validation so that the item does not contain special characters (or numbers or spaces) other than salvation fen. That is to say, the element must contain only alphabets or ' - '. Tried to use the Is_Alpha function, but do not know how to handle this exception to the use of '-' in validation. So please, can someone suggest me a solution.

    Thank you
    Vignesh

    Vignesh,

    You can create Validation based on return Boolean and returns a False when the element has charecters other than 'A - Z' (charecters upper and lower) and - (hifen).

    if trim(translate(upper(:P1_ENAME), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-'
                                                      '                                                  ') is null then
       return false;    -- replacing all the alphabets and hifen with spaces... trim will leave an empty string(which is null)
    else
       return false;
    end if;
    

    Based on the following sql instructions...

    sql> select nvl(trim(translate(upper('ASDFG---'), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-',
      2                               '                           ')),'Null Value')
      3     from dual;
    
    NVL(TRIM(T
    ----------
    Null Value
    
    sql> ed
    Wrote file afiedt.buf
    
      1  select nvl(trim(translate(upper('9999Asf---'), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-',
      2                               '                           ')),'Null Value')
      3*    from dual
    sql> /
    
    NVL(
    ----
    9999
    
  • On initial Setup, I enter a computer name using only valid characters and get an error message saying that some characters are not valid.

    I installed Win7 using a .wim that I used successfully several times before. The .wim is on my USB and the computer is not connected to the network. Using a disk to start Windows PE and imagex, I applied the image. When Windows 7 was started for the first time and prompted me to a computer name, I entered a name with only lower and upper case characters. An error message told me that some characters that I had used were not valid and listed the characters not valid, which I had used.

    What is my next course of action?

    I did a hard reboot and Windows later accepted my computer name.

    This has been resolved.

  • Path for some characters only to compensate for

    Hello

    In a text written with the text tool, is it possible to offset the path for some characters only and not the entire text? FX menu is all gray when I select individual characters.

    This is for CS4.

    Thank you.

    What about using a script?

    like the Carlos those here

    Re: How to divide all managers of related one-character-by-textFrame?

  • How to select username contains only 7 strings

    from dba_users, how to select username contains only 7 channels?

    Select decode (length (username)?) Please help. I just need to print the users whose name is exactly 7 charactars.

    Try something like
    SELECT username FROM dba_users WHERE LENGTH (username) = 7;

  • Selection of rows where column string contains special characters.

    Hey there,

    Im trying to select rows based on a column containing a bar slash.

    I tried

    where substr (col1, INSTR(col1,'/'), INSTR(col1,'/') + 1)

    but no luck, is there a special way to treat this?

    Thanks in advance,
    Date of birth
    instr (str, '/') > 0
    

    as in

    SQL> with test
      2  as
      3  (select 'this first string contains / a slash' str from dual union all
      4   select 'this second string contains / a slash' str from dual union all
      5   select 'this third does not' str from dual
      6  )
      7  select *
      8    from test
      9   where instr (str, '/') > 0
     10  /
    
    STR
    -------------------------------------
    this first string contains / a slash
    this second string contains / a slash
    
  • The specified account name is not valid, because account names cannot contain the following characters * {} [] +=? *

    Original title: can't do user account
    I can't do a different account on my windows vista computer.  When I try to make another account, it says this "the specified account name is not valid, because account names cannot contain the following characters * {} [] +=?" "*" even if I don't use any of those what should I do?

    the only account on my computer is a guest account, it's a story of administering it. This is - why it doesn't let me make a new account? had this problem for 2 years

    Hello

    Try these steps to create a new account:
    a. log on under an account that has administrator privileges.
    b. Click Start.
    c. type the three letters cmd in the search box.
    d. press Ctrl + Shift + Enter
    e. click "Run as Administrator".
    f. type the following commands and press ENTER after each one:
    net users
    NET user 'Jack' xxyyzz / add
    net localgroup administrators/add ' Jack'

    The first command displays all existing account names.
    The second command creates an account named 'Jack' with a password of "xxyyzz".
    The third command will make Jack administrator.

    Check the link for more help:
    Create a user account
    http://Windows.Microsoft.com/en-us/Windows-Vista/create-a-user-account
  • Decoding UTF - missing some characters

    Hello..

    I get a JSON from the server as

    {.........
    "title": "Nice!â\u0084¢ Honey",
    "totalinterestexposureratio": "",
     "vo": "item" }
    

    I use the following method of decoding UTF-8

    public static String UTF8Decode(byte in[], int offset, int length) {
            StringBuffer buff = new StringBuffer();
            int max = offset + length;
            for (int i = offset; i < max; i++) {
                char c = 0;
                if ((in[i] & 0x80) == 0) {
                    c = (char) in[i];
                } else if ((in[i] & 0xe0) == 0xc0) // 11100000
                {
                    c |= ((in[i] & 0x1f) << 6); // 00011111
                    i++;
                    c |= ((in[i] & 0x3f) << 0); // 00111111
                } else if ((in[i] & 0xf0) == 0xe0) // 11110000
                {
                    c |= ((in[i] & 0x0f) << 12); // 00001111
                    i++;
                    c |= ((in[i] & 0x3f) << 6); // 00111111
                    i++;
                    c |= ((in[i] & 0x3f) << 0); // 00111111
                } else if ((in[i] & 0xf8) == 0xf0) // 11111000
                {
                    c |= ((in[i] & 0x07) << 18); // 00000111 (move 18, not 16?)
                    i++;
                    c |= ((in[i] & 0x3f) << 12); // 00111111
                    i++;
                    c |= ((in[i] & 0x3f) << 6); // 00111111
                    i++;
                    c |= ((in[i] & 0x3f) << 0); // 00111111
                } else {
                    c = '?';
                }
                buff.append(c);
            }
            return buff.toString();
        }
    

    But I do get some characters (eg. sign of registration).

    Knowledge appropriate algorithms

    String myString;

    try {}

    myString = new String (inBytes, "UTF - 8");

    } catch (Exception e) {}

    }

    If the characters appear as black squares, then it is possible that the police does not contain the correct symbol.  If you see the "?", this usually indicates a failure of the conversion.

  • Syntax to check whether an item contains a particular value

    Hello
    In my rtf model, I'm changing the background color according to the value of a security of people. I am unable to verify the exact values, but all of the titles are the same, but contain the same value in the full title (e.g. Secretary main vs vs Support Secretary Executive Secretary). So instead of checking where TITLE = 'Secretary', I need to know how to check where the TITLE contains "Secretary". I don't understand the syntax.
    Any help would be appreciated!
    T

    One way is to test instring Secretary.

    InStr('abcabcabc','a',2)
    The instr function returns the location of a substring in a string. The syntax of the instr function is:

    InStr (string1, string2, [start_position], [nth_appearance])

    string1 is the string to search for.

    string2 is the substring to search for in string1.

    start_position is the position in string1 where the search will begin. The first position in the string is 1. If the start_position is negative, the function account back start_position number of characters from the end of string1, then research toward the start of string1.

    nth appearance is the appearance of Nth of string2.

Maybe you are looking for

  • How can I get only checked songs to play on my 6 s Iphone?

    Hello.  I recently got a new Iphone 6s, upgrade to a 5.  I'm not a huge phone guy, so I don't know a ton about the inner workings of the working of the machine.  That said, on my old phone, whenever I had a song that has been disabled, it wouldn't sy

  • Satellite P300-1EJ - Mute button does not work

    Hello world Press mute on the media panel is no longer functional.I have the Satellite P300 1EJ. Help, please

  • Windows Update does not update

    Updates say they cannot not be achieved and that the changes are coming back, I have around 430 MB, updates that does not install

  • Rebel t5i raw + jpeg - raw files not saved on sd card

    I shot several pictures with the cam in Raw + jpeg setting. From sd card and inserted into the pc sd reader. Only did jpeg - no raw files. Same results with win 8.1 and win 7. I see a file 'misc', but not of .cr2 files.

  • upgrade sleekbook 6z amd form

    HP Envy 6z Product # B3C88AV I upgraded to amd a10 hearts - 4655 m, ssd crucial 128 GB, 16 GB DDR3 1333 Mhz ram m4. No other factory options have been added outside of the apu. I'm running Kubuntu beta 12.10, with the Windows 7 virtual machine. Cours