Finding the smallest letter in a single alphanumeric string

How do I find the smallest letter in a single alphanumeric input?
I already wrote and successfully tested the code that takes an alphanumeric string as input, separates the number from the alphabet, and creates a new alphabetic string. However, I'm unsuccesful in writting the code to find the smallest letter within the alphabetic string. I am almost certain that the easy answer is Arrays.sort, but I unsuccesfully tried writing the code to place the alphabetic string into an array. I researched compareTo, but I do not have another object to compare?! Any suggetsions?

Ahh flaimbait - I'm sure I'll get criticized for this... but - while we are talking about time-to-market, etc...:
The most important issue in development is to make sure that you understand the project requirements. The requirements in this situation were:
Find the smallest character in a string.
Given that, then any developer that goes through the trouble of looking up the sort APIs, etc... is not helping themselves - all they really needed to do was to write one line of code (as xxxx graciously posted):
for (int x=0; x<foo.length(); x++) if (foo.charAt(i)<low) low=foo.charAt(x);I absolutely guarantee that any Java programmer could write the above faster than they could figure out how to split a string appart by characters, look up the arraysort API, etc...
The arraysort functions are EXTREMELY efficient, and I would never suggest that someone re-implement them. The point here is that just because you've got a wrecking ball available, you can still use a hammer to drive a nail.

Similar Messages

  • Finding the smallest value from an array

    Hi there :)
    I started learning Java a few days ago and have now run into my first problem :p
    I am using Netbeans on Mac OS X.
    I need to find the smallest value from an array. So far I've had no luck. Any suggestions would be fantastic.
    The code so far:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
            int O = A.length - 3;
            int B = A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7] + A[8] + A[9] + A[10] + A[11] + A[12] + A[13] + A[14];
            A[15] = B;  // Stores the sum of the integers in A[15]
            int C = B / O;
            A[16] = C;  // Computes and stores the average in A[16]
            int D = 101;
                if (A[0] < A[1]) { D = A[0]; }
                else { D = A[1]; }
                if (A[1] < A[2]) { D = A[1]; }
                else { D = A[2]; }
            System.out.println("There are " + O + " numbers in the Array");
            System.out.println("Those numbers add up to " + B + ".");
            System.out.println("The average of those numbers is " + C + ".");
            System.out.println("The smallest value in the array is " + D + ".");
    }The code is incomplete, but it works so far. The problem is I know there must be an easier way. SAVE ME :)

    OK :)
    Just thought I should show you the output as to help anyone else with the same problem:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17                           // COMPLETED
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    import java.util.Arrays;
    public class Main { 
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
         public static void main(String[] args) {
                  int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
              Arrays.sort(A);
              System.out.println("The smallest value in the array is " + A[0] + ".");
              int num = A.length;
              System.out.println("There are " + num + " values in the Array.");
              int sum = 0;
              for (int i = 0; i < A.length; i++) {
                   sum+=A;
              System.out.println("Those numbers add up to " + sum + ".");
              double d = (double)sum/num;
              System.out.println("The average value of those numbers is " + d + ".");
    What Iearned:
    1) How to create for loops properly
    2) How to import java.util.Arrays ( =D )
    3) How to get a more accurate average using double instead of int
    4) This forum is the best and has very helpful people 24/7 ( =D)
    Thanks Again,
    Mo.

  • How do I find the smallest element of a doubly linked list?

    I currently have a doubly link list, each node contains two datafields df1 and df2. I need to find the smallest of df2 contained in the list and swap it with index one - until the list is sorted.
    Any ideas on how to search a doubly linked list for the smallest element would be greatly appreciated, thanks for your help.
    ps: I have found methods for find an element in a list and tried to alter it to find smallest, but my dfs are objects and I am having difficulty with the comparison.
    thanks so much for your time.

    I have given some comments in your other thread and instead of finding the minimum in each scan, you can do "neighbour-swaps". This will sort the list in fewer scans.

  • UDF for Find the First letter from Input

    Hi Masters,
    I want find the first letter from input, Can any one help me on this..UDF or any solution.
    Ex: E2HB means - Alpha Letter is the first
    Ex: 1234 means - Number is the first
    Thanks,
    Siva

    Hi Siva,
                I just want to clarify this doubt, you want the first character of the string you pass to the UDF i.e if input="E2HB"  output="E"   and if input="1234"   output="1". If my assumption is correct you can try the UDF "firstChar" I have shown below this gives exactly the output you want
    public class firstLetter {
         public static String firstChar(String s)
              if(s==null)
                   return null;
              if(s.equals(""))
                   return s;
              String t="";
              t+=s.charAt(0);
              return t;
         public static void main(String[] args) {
              String s1="E2HB",s2="1234";
              s1=firstChar(s1);
              System.out.println(s1);
              s2=firstChar(s2);
              System.out.println(s2);
    Regards
    Anupam

  • How do I find the unix system is in single user mode  ?

    How do I find the unix system is in single user mode ?
    thanks
    siva

    Please run 'who -r', and then check the man page of 'init' for interpreting the run level output.

  • How to find the space used by a single table, a index on that table etc

    Can someone tell where to locate for the Extents used by a single table , index and other objects

    A large question implies a large answer, read the reference guide
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm
    and search dba_extents...
    Nicolas.

  • Need to find the memory address of a buffer or string

    Two basic questions:
    -How does LabVIEW treat the concept of a "buffer"?  Isn't it just a string wired from one block to another?
    -How can I find the address of a memory location or buffer location?
    I am using the Call Shared Library Node to call two functions to unwrap a custom communication protocol packet.  I will be reading packets of information from the serial port and sending them through this unwrapper  The first function expects as the arguments a)the address of the buffer and b)the length (in bytes) of the buffer.  I can measure the length, but am unsure of the address.  I would have just wired the string output of the serial port to the input of the unwrapper, but the unwrapper wants the address of that string/buffer.  The data type of the buffer address that the function expects is "unsigned char*" in C++ which translates to "uInt8" in LabVIEW according to http://zone.ni.com/devzone/cda/tut/p/id/3009.  The second function that is being called writes the unwrapped data to the destination buffer address that I specify as an argument. 
    I located this VI that handles buffering, but am unsure how it would help me, because it doesn't deal with the address issue either (and it used arrays of doubles, not characters or strings which is what the output of the serial port will be).  http://zone.ni.com/devzone/cda/epd/p/id/2499
    Any help would be appreciated.
    Nathan
    Previous related post: Call Library Function Node: Instantiate a class/handle constructors in a C++ Shared Library?

    This question is probably better asked on the LabView forum.  I've never seen this type of question asked here.
    Duncan
    CVI user, even though I also have LabView ;-))

  • Need help in finding the position of a SubString in a String

    Hi All,
    I have a VARCHAR2 column in my table which has data similar to '152-425-3265-8-5623-45'.
    I want to find the position of the numbers in the column.
    For example:
    If i give 8 - query should return me 4.
    If i give 425 - query should return me 2.
    The numbers are delimited with '-' value.
    Please help.
    Thanks in advance.
    Edited by: 868171 on Jun 24, 2011 4:33 AM
    Edited by: 868171 on Jun 24, 2011 4:34 AM

    do you know the max number of dashes?
    if so
    with t as (select  '152-425-3265-8-5623-45' code, '425' num from dual union
                   select  '152-425-3265-8-5623-45' code, '8' num from dual)
    select code, num, case num when  regexp_substr( code,'[^\-]+',1,1) then '1'
                   when  regexp_substr( code,'[^\-]+',1,2)  then '2'
                   when  regexp_substr( code,'[^\-]+',1,3) then '3'
                   when  regexp_substr( code,'[^\-]+',1,4)  then '4'
                   when  regexp_substr( code,'[^\-]+',1,5) then '5'
                   when  regexp_substr( code,'[^\-]+',1,6)  then '6'
                   else 'not found' end result
    from t
    CODE     NUM     RESULT
    152-425-3265-8-5623-45     425     2
    152-425-3265-8-5623-45     8     4or if you have 11g you can use regexp_count
    with t as (select  '152-425-3265-8-5623-45' code, '425' num from dual union
                   select  '152-425-3265-8-5623-45' code, '8' num from dual)
    select code, num, regexp_count(regexp_substr(code,'^.*'||num||'.'),'-')
    from tEdited by: pollywog on Jun 24, 2011 7:55 AM

  • Finding the position of an integer in a string

    I haven't done much Java programming for the past 3 months, but I'm trying to get back into it now, but I'm having some trouble. I'm trying to break up a string of integers, to store each individual integer in an array.
    So, if I had something like 132412344, a for loop would put them all into separate arrays.
    I know that there is a charAt() function, but is there something like that for integers?

    Do you know whether every single character in the string is an integer?
    If it is, then toCharArray will get you the array. Then you could loop through it to parse each character into an int. You can use Character.digit to do that.
    I doubt that there's any method that automatically splits a string and returns the integers represented by the characters in a string. It seems like too specialized a method. But I could be wrong.

  • Find the number of consecutive numeric digits in string

    I am trying to see if a string has say 9 consecutive numeric digits in it but it will only work if the long string of numbers is the first string of numbers.
    e.g.
    This would recongnise the following string (if p_len = 9)
    Tel number 20 20 30 369 for 2nd meeting
         but would not recongnise the following
    For 2nd meeting tel 20 20 30 369
    Could anyone give guidance on how to proceed / a better way of find consecutive numbers in a string?
    Thanks
    Simon
    Code sample -
        LOOP AT TLINETAB.
    Remove blank spaces
          CONDENSE TLINETAB-TDLINE NO-GAPS.
    Find first number and its position *
          IF TLINETAB-TDLINE CA '0123456789'.
            pos = sy-fdpos.
    Does the next x characters contain only numbers?
            IF TLINETAB-TDLINE+pos(p_len) CO '0123456789'.
              append i_report.
            endif.
          ENDIF.
        ENDLOOP.

    Dear Simon,
    you want to check for consecutive numbers in a string. Then you may do the following -
    1. Get all the numbers in the given string into a table in a sequencial order, that is the order in which they appear in the string
    2. Once you have all the numbers you may find out if the numbers are consecutive or not. The following is the code which is not tested
    lv_len = 1.
    lv_pos = 1.
    lv_strlen = strlen ( lv_str ).
    do lv_strlen times.
      lv_alpha = lv_str+lv_pos(lv_len).
      if lv_alpha co '0123456789'.
       append lv_alpha to lt_number.
      endif.
      lv_pos = lv_pos + 1.
    enddo.
    loop at lt_number into ls_number.
      if lv_no is initial.
       lv_no = ls_number.
       lv_no = lv_no + 1.
      else.
       if ls_number eq lv_no and
          lv_consec is initial.
        lv_consec = c_x.
       else.
        clear lv_consec.
       endif.
      endif.
    endloop.
    if lv_consec eq c_x.
    *  !!! string has consecutive numbers
    endif.
    Hope it helps. Thank you.
    Regards,
    kartik

  • Can't find the variable used in Apex using Substitution String #

    Hi,
    Someone put in a substitution string for a user defined variable. #variable#. I can't find it. Looked through the shared components. Any advice? Thanks.

    Export your application and use a good text editor to search on that string and you will find it if it is there.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Trying to find out how to get the smallest value in a 2-D array

    I figured out how to get the largest and smallest in a 1-D array, but I'm having trouble with the for loop for the 2-D array
    I can't seem to figure out how I can get it to check every element in the 2-D array
    Lets say I have this array
    int[][] aRay = new int[][] {{ 1, 2, 3} , {4, 5, 6 }};and I want to find the smallest value, I think I can figure out what goes in the box of the for loop I just need help with how I can check every element..
    Thanks all

    Ok so here's what i've got so far and my brain is starting to hurt,
    My output right now is "2".. i'm almost there :/ aren't I?
    public class bladddhd
         public static void main( String [] args )
         int[][] aRay = new int[][] {{ 1, 2, 3} , {4, 5, 6 }};
              int length2 = aRay[0].length;
              int temp = 0;
              for(int i = 0; i < aRay.length; ++ i)
                        if(aRay[0] > temp)
                             temp = aRay[0][i];
                        for(int j = 0; j < length2; ++j)
                                  if(aRay[1][j] < temp)
                                       temp = aRay[1][j];
                   System.out.println(temp);

  • How do I find out about the driver letter of a usb drive by script, given the DeviceID

    Hi all,
    I am wondering if it is possible by script to find out what the drive letter of a usb drive might be.
    I have just inserted my USB stick into a socked and the operating system displays that the drive was recognized and that the drive letter is F:.
    I already know, how USB devices can be listed by WMI script, but how do I extract the drive letter of a USB storage device.
    The DeviceID is known, where do I find the drive letter given the DeviceID ?
    Disk drive
    DeviceID:
    USBSTOR\DISK&VEN_SAMSUNG&PROD_YP-U2&REV_0100\4002FDCCE0E4D094&0
    Service: disk
    Status: OK
    SystemName: MEINER
    Caption: Samsung YP-U2 USB Device
    All help is welcome

    @echo off  
    :: GetLetterOFmyUSBstick.cmd  
    :: Bye Gastone Canali  
    ::DeviceID: USBSTOR\DISK&VEN_SAMSUNG&PROD_YP-U2&REV_0100\4002FDCCE0E4D094&0  
    setlocal EnableDelayedExpansion  
    set PNPDeviceID=4002FDCCE0E4D094 
    set Q='wmic  diskdrive where "interfacetype="USB" and PNPDeviceID like "%%%PNPDeviceID%%%""    assoc /assocclass:Win32_DiskDriveToDiskPartition' 
    echo %Q%  
    for /f "tokens=2,3,4,5 delims=,= " %%a in (%Q%) do (  
      set hd=%%a %%b, %%c %%d  
      call :_LIST_LETTER !hd!)  
    goto :_END  
    :_LIST_LETTER  
    (echo %1 |find  "Disk ") >nul|| goto :_EOF   
    for /f "tokens=3 delims==" %%a in ('WMIC Path Win32_LogicalDiskToPartition  ^|find %1') do set TMP_letter=%%a  
    set Part_letter=%TMP_letter:~1,2%   
    echo %Part_letter% %1  
    goto :_EOF  
    :_END  
    :_EOF  
    ' ' GetLetterOFmyUSBstick.vbs
    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")  
    strPnPdevID = "USBSTOR\DISK&VEN_SAMSUNG&PROD_YP-U2&REV_0100\4002FDCCE0E4D094&0" 
    strPnPdevID = Replace(strPnPdevID, "\", "\\")  
    Set colDiskDrives = objWMIService.ExecQuery ("SELECT * FROM Win32_DiskDrive where PNPDeviceID like '"& strPnPdevID &"' ")  
    For Each objDrive In colDiskDrives  
        Wscript.Echo "Physical Disk: " & objDrive.Caption & " -- " & objDrive.DeviceID   
        strDeviceID = Replace(objDrive.DeviceID, "\", "\\")  
        Set colPartitions = objWMIService.ExecQuery _  
            ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _  
                strDeviceID & """} WHERE AssocClass = " & _  
                    "Win32_DiskDriveToDiskPartition")  
        For Each objPartition In colPartitions  
            Wscript.Echo "Disk Partition: " & objPartition.DeviceID  
            Set colLogicalDisks = objWMIService.ExecQuery _  
                ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _  
                    objPartition.DeviceID & """} WHERE AssocClass = " & _  
                        "Win32_LogicalDiskToPartition")  
            For Each objLogicalDisk In colLogicalDisks  
                Wscript.Echo "Logical Disk: " & objLogicalDisk.DeviceID  
            Next 
            Wscript.Echo  
        Next 
        Wscript.Echo  
    Next 

  • How to find the most matched values in the set of map?

    Hi friends!
    I have two vectors
    vector<int> V1; vector<int> V2;
    and a map<int, set<int>> M1;
    I want to select common values from both V1 and V2 and check those values with the set in the map M1.
    For example:
    V1 contains;
    2  4  6  8  9
    V2 contains;
    4  5  6  9  10 
    M1 contains;
    1=>1  2  5  9
    2=>4
    3=>5   10
    4=>2  4  8
    5=>4   9
    6=>4   6
    7=>9  12
    When we select the common values of V1 and V2 it is 4, 6, 9.
    And we search for all 4, 6, 9 from the values of M1 which give more appropriate.
    But, no all values in the set of map.
    Then, we delete any value from 4, 6, 9, then remaining values would match any values from the map.
    From the example, if we delete 6, then remaining 4, 9 will match with 5=>4  9, or if we delete 9, then 6=>4   6. Any one of the keys can be selected.
    I know how to select the common values from V1 and V2, but I do not know how to match with the values and select the appropriate key from M1.
    Could anyone help me to solve this?

    This is not the question you asked, except perhaps in the subject. The subject is not the right place to put key features of the question. It is also important to use the body to ask just the question you want
    answered. For example your real question has nothing to do with V1 and V2, just the common vector V (e.g. 4 6 9).
    One way to solve your problem would be to create a new map
    map<int, set<int>> M2;
    with the same keys as M1. Each set of M2 should contain the elements of V that are
    not in the corresponding set of M1.
    Then pick the key of M2 that has the smallest set. If that set is empty, then the whole of V can be used. Otherwise the smallest set tells which elements of V have to be removed, and which is the desired key of M1.
    In your example, key 5 of M2 will contain just 6, so you should remove 6 from V and select key 5.
    Yes fine. I tried the following code and it creates the map M2 (NewMyMap in my code). But how to find the smallest set starting from size 1?
    #include <vector>
    #include <algorithm>
    #include <iostream>
    #include <map>
    #include <set>
    using namespace std;
    typedef vector<int> IntVec;
    typedef set<int> IntSet;
    typedef map<int, IntSet> SetMap;
    bool IsValueNotInSet(int value, IntSet& S);
    SetMap CreatNewSetMap();
    IntVec IVec; //This vector is for selecting certain keys from mySet map.
    IntVec myVec;
    SetMap mySet;
    SetMap NewMyMap;
    int main()
    IVec.push_back(3); IVec.push_back(4); IVec.push_back(5); IVec.push_back(6);
    myVec.push_back(4); myVec.push_back(6); myVec.push_back(9);
    IntSet tempS;
    tempS.insert(1); tempS.insert(2); tempS.insert(5); tempS.insert(9);
    mySet.insert(make_pair(1,tempS));
    tempS.clear();
    tempS.insert(4);
    mySet.insert(make_pair(2,tempS));
    tempS.clear();
    tempS.insert(5); tempS.insert(10);
    mySet.insert(make_pair(3,tempS));
    tempS.clear();
    tempS.insert(2); tempS.insert(4); tempS.insert(8);
    mySet.insert(make_pair(4,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(9);
    mySet.insert(make_pair(5,tempS));
    tempS.clear();
    tempS.insert(4); tempS.insert(6);
    mySet.insert(make_pair(6,tempS));
    tempS.clear();
    tempS.insert(9); tempS.insert(12);
    mySet.insert(make_pair(7,tempS));
    cout<<"MYVEC\n";
    cout<<"-------------\n";
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    cout<<(*itv)<<" ";
    cout<<"\n\n";
    cout<<"\nMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its = mySet.begin(); its != mySet.end(); ++its)
    cout << endl << its->first <<" =>";
    for(IntSet::iterator sit=its->second.begin();sit!=its->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    NewMyMap= CreatNewSetMap();
    cout<<"\nNEWMYSET\n";
    cout<<"-------------";
    for(map<int,set<int>>::iterator its1 = NewMyMap.begin(); its1 != NewMyMap.end(); ++its1)
    cout << endl << its1->first <<" =>";
    for(IntSet::iterator sit=its1->second.begin();sit!=its1->second.end();++sit)
    cout<<" "<<(*sit);
    cout<<"\n\n";
    return 0;
    bool IsValueNotInSet(int value, IntSet& S)
    IntSet::iterator it=find (S.begin(), S.end(), value);
    if (it!=S.end())
    return false;
    return true;
    SetMap CreatNewSetMap()
    IntSet TSet;
    for(IntVec::iterator it = IVec.begin(); it != IVec.end(); ++it)
    SetMap::iterator its = mySet.find(*it);
    if (its != mySet.end())
    TSet.clear();
    int key = its->first;
    IntSet& itset = its->second;
    for(IntVec::iterator itv = myVec.begin(); itv != myVec.end(); ++itv)
    if(IsValueNotInSet((*itv), itset))
    TSet.insert(*itv);
    NewMyMap.insert(make_pair(key,TSet));
    return NewMyMap;

  • Create a customer code using the First letter of a customer name and the last 4 digits of a phone number

    I am trying to create a form where one the customer has input their name and phone number it should grab the first letter of the customer's name and then the last 4 digits of the phone number.
    I am not very good at coding, and have VERY VERY limited background in coding. I understand a little (the basics pretty much).
    I am thinking i am not using the right expression to get what i want. Below is the statement I have write. This is just to find the first letter of the name, have an idea on how to get the phone number but i was trying the use the "left" and "right" functions but they wouldn't work. More specifically the left.
    form1.#subform[0].CustCode::initialize - (JavaScript, client)
    str = CustName;
    var a = str.substr(0, 1);
    any help would be greatly appreciated.
    If more information is needed, please don't hesitate to ask.

    If you switch your language to FormCalc you can use the Left and Right functions, e.g.
    Concat(Left(Name,1) , Right(Phone,4))

Maybe you are looking for

  • 24" iMac having startup issues

    I thought I would post here in an effort to try and see if there is anything else I can do before heading to an Apple Store tomorrow. I own a 24" iMac, which I got in the fall 2006. A few weeks ago, this problem first occurred. The computer started u

  • How to format numeric result in a datatable?

    I have a View Object (not tied to an Entity Object) that is displaying a read-only table that includes numeric values. I'm not able to figure out how to control the display formatting so that only 1 decimal place is shown - right now the numbers are

  • Lost all audio

    I have an HP Envy 17 running Windows 7. All audio on my computer (DVDs, mp3 files, system sounds, etc) has suddenly stopped working. Perhaps not coincidentally, a large number of Windows updates were just applied to my computer. How should I proceed?

  • Help with Mac 10.4.11 and Adobe CS5 compatibility?

    I have a Mac OS X 10.4.11, and am attempting to open Adobe Illustrator CS5. The program is only compatible, however, with Mac 10.5 and higher. Is there a way I can upgrade my software or what should I do?  (my computer says no new upgrades are availa

  • In MacBook Pro when inserting cd/dvd disc, it is ejected with message, media is not supported

    When inserting cd/dvd into disc drice, it is processed to some point and then ejected with message, media is not supported