Check last letter in a string

Good Day All,
I have a string field that does not a Consistence length.
I want to check the last of this field and concatenate some text depending on the result.
I've tried this but does not work.
if mid({usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name,1 Len{usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name}-1) = "M"
then {usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name} & " Managed"
else {usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name} & " Unmanaged
Basically I'm check the length and if return an M it's Managed everything else is Unmanaged.
Thanks
DM

if you want to check last letter then try this
if right({usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name},1)="M" then
then {usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name} & " Managed"
else {usp_wb_Reporting_AssetsUnderManagement_A2a_Main;1.account_long_name} & " Unmanaged
Regards,
Raghavendra

Similar Messages

  • Get last letter of a string....

    Hi guys.
    Have a problem with ABAP in SAP.
    I need to get the last character of the string, like this...
    'AAAAAAAA            BBBB  1                QQQQQQQQ       2'.
    i need to take the last letter (2) to do more things b4.
    I'm thinking to rotate the string and take the first letter, but i think will exist a FM that do my requirement.
    See you.
    Thanks: Miguel

    Hi,
    First get the string lengthof the variable.
    data: lv_string type char4 value 'ABCD',
          lv_new type i,
          lv_new1 type char2.
    *lv_new = strlen(lv_string).
    CALL FUNCTION 'STRING_LENGTH'
      EXPORTING
        string        = lv_string
    IMPORTING
       LENGTH        = lv_new
    lv_new = lv_new - 2.
    lv_new1 = lv_string+lv_new(2).
    write lv_new1.
    You get the last two characters.
    reward if useful..
    regards,
    nazeer
    Message was edited by:
            nazeer shaik

  • Got last letter in String

    HI all ,
    how to got the right part of my string in java?
    String Name =req.getParameter("Horst");in sql i can use
    SELECT right(Name, 2) to got the last letter in string , but when I modify the code as Syear="SELECT right('"+Name+"', 2)"; I got error . is java have function to got last letter in string??
    thank you!

    String s1 = "HELLO";
    String s2 = s1.substring(s1.length() - 1);

  • Finding last char in the string

    Hi
    i need to find out whether the last char of a string is '/' (forward slash). please let me know if there's a FM to do that. Other post me the logic for this ASAP.
    thanks

    len = strlen(char).
    len = len - 1.
    if char+len(1) = '/'.
      *write ur code
    endif.
    chk this code
    REPORT ychatest.
    DATA : str(5) VALUE '123/',
           len TYPE i.
    len = STRLEN( str ).
    len = len - 1.
    IF str+len(1) = '/'.
      WRITE : '/ found'.
    ENDIF.
    <b>Reward points if helpful and close thrad if solved</b>
    Message was edited by: Chandrasekhar Jagarlamudi

  • Confirmations- (check last entered % and input on the same screen)

    wanted to check if there's any transaction where you can check last entered degree of processing for confirmation and enter the current degree of processing/% of completion on the same screen.
    tried CN48N but it isn't allowing to enter confirmations..

    Hi
    Execume me Moderator for posting for closed thread.
    Wanted to correct or update my posting.
    You can also use CN48N with fileds Counter, Degree of procssing so that it will let you know the percentage of completion.
    Regards,
    PSR

  • To extract the last word in a string

    Hi
    I am using BODS 14.1.1.210 
    I would like to extract the last word in a string in BODS query. How can I achieve this when  I don't know how many words are present in a space delimited string.
    Example
    Input                                              Output    
    My name is Tim                              Tim
    Complicated                                    Complicated
    there is a bird in the nest                 nest
    Please let me know if there is a query function for this one.
    Cheers!

    Hi,
    try this-
    word_ext(fieldname,-1,' ')
    Atun

  • Checking last character

    What would you consider being the best way to check the last character of a string?
    var folderPath = '~/Desktop/Test';
    if (folderPath[folderPath.length - 1] !== '/') { folderPath += '/'; }
      or
    if (folderPath.slice(-1) !== '/') { folderPath += '/'; }
    I see that changePath() can also be used to keep track of this path separator.
    Thanks.

    Hi Hans,
    I was trying to come up with a function to move a folder and it's contents, or a file... similar to how the OS X Finder would do it.  However, I just noticed when the files are copied over, they're not the same file size as the original which makes me think it's stripping resource forks, etc.  :-(
    I'm looking now at using doScript and running ditto from the command-line with applescript.  Here's the code I was working with earlier though:
    function moveItem(oldPath, newPath) {
        newPath = newPath.toString();
        //if (newPath[newPath.length - 1] !== '/') { newPath += '/'; }
        if (newPath.slice(-1) !== '/') { newPath += '/'; }
        var oldPathType = oldPath.constructor.name;
        if (oldPathType === 'Folder') {
            newPath += (oldPath.name + '/');
            with (Folder(newPath)) {
                if (! exists) { create(); }
            for each (var i in oldPath.getFiles()) {
                if (i.constructor.name === 'Folder') {
                    moveItem(i, newPath);
                } else {
                    i.copy(newPath + i.name);
                    i.remove();
            oldPath.remove();
        } else if (oldPathType === 'File') {
            oldPath.copy(newPath + oldPath.name);
            oldPath.remove();
        } else {
            throw 'Problem moving file/folder!';

  • Testing the last character of a string using .endsWith

    Hi,
    I want to check to see if the last character of a string is '@'.
    I tried if (StringAt.endsWith("a")) {
    but got no results.
    Is this the correct way to do it or is there another way.
    Thanks.
    Adam

    javadocs:
    String's endsWith method takes a string argument.
    endsWith
         public boolean endsWith(String suffix)
              Tests if this string ends with the specified suffix.
              Parameters:
                   suffix - the suffix.
              Returns:
                   true if the character sequence represented by the argument is a suffix of the character sequence
                   represented by this object; false otherwise. Note that the result will be true if the argument is the
                   empty string or is equal to this String object as determined by the equals(Object) method.
              Throws:
                   NullPointerException - if suffix is null.

  • Read last char of a String

    I have the following code that functions like a basic RPN calculator:
    public class Main {
         * @param args the command line arguments
         static public ArrayList<Double> stack = new ArrayList<Double>();
         static double numberInput;
         static double answer;
         static String operation;
    //Prints Welcome screen, initialized checkforInput
         public static void main(String[] args) {
             System.out.println();
             System.out.println("Welcome to RPNCalc by theCoffeeShop()");
             checkForInput();
    //Checks for input, redirects to appropriate method
         public static void checkForInput() {
             Scanner reader = new Scanner(System.in);
          String input = reader.nextLine();
             if(isDouble(input) == true) {
                double number = Double.parseDouble( input );
                stack.add(0, number);
                repeat();
             } else {
                operation = input;
                operation();
    //Processes numeric operations
         public static void operation () {
             if(operation.equals("+")) {
                 answer = stack.get(1)+stack.get(0);
                 stack.add(0, answer);
                 System.out.println(answer);
                 repeat();
             } else if (operation.equals("-")) {
                 answer = stack.get(1)-stack.get(0);
                 stack.add(0, answer);
                 System.out.println(answer);
                 repeat();
             } else if (operation.equals("*")) {
                 answer = stack.get(1)*stack.get(0);
                 stack.add(0, answer);
                 System.out.println(answer);
                 repeat();
             } else if (operation.equals("/")) {
                 answer = stack.get(1)/stack.get(0);
                 stack.add(0, answer);
                 System.out.println(answer);
                 repeat();
             } else {
                 System.out.println("Incompatible operation");
                 repeat();
    //Called when ready to recheck for input
         public static void repeat() {
             checkForInput();
    //Checks if string is double
         public static boolean isDouble( String input )
            try
                Double.parseDouble( input );
                return true;
            catch(Exception e)
               return false;
    }To perform a basic operation (5+2), you would do the following
    5
    enter
    2
    enter
    (plus)
    enter
    Computer prints 7.
    I would like it to function like this:
    5
    enter
    2(plus)
    enter
    Computer prints 7.
    To do this, I have to be a be to split a string into 2 parts, the operation and the number. I think I could do this with a StringBuffer, but How to read the LAST char of a StringBuffer, instead of just a specific char? If there is a way to do it w/out a StringBuffer, I'm open to suggestions.

    Hint:
    The last character of a String (or StringBuilder or StringBuffer, etc.) is at the index (length_of_string - 1).
    Are you sure you're supposed to solve the problem this way? Usually homework assignments of this sort involve writing a whole parser.

  • How to delete the last char in a String?

    i want to delete the last char in a String, but i don't want to convert the String to a StringBuffer or an array, who knows how to do?

    Try it in this way
    String MyString = "ABCDEF";
    MyString = MyString.substring(0,MyString.length()-1);

  • Truncating last character in a string

    I am making a dialpad. It is just for display so I am using a
    string for the numbers selected. I am trying to make a back button
    that would clear the last number added. I tried mystring.length-1
    but that doesn't seem to be doing the trick. Is there a simple way
    to truncate the last character in a string, of variable
    length??

    Here's an example
    var someStr="asdfasdf saf asdf sadfas dfs fsa asf";
    while (someStr.length) {
    someStr = someStr.substring(0,someStr.length-1)
    trace(someStr);
    }

  • How to remove only the last element of spreadsheet string

    I use path to string option to store image path into database and while retrieving the string is again converted into path but it gives out an error as the output of array to spreadsheet string gives out a tab at the end which is unable for the IMAQ read file to recognise.but when i use the path of the image directly into IMAQ readfile the image is opened . so how to remove the tab only at the end of output of the spreadsheet string(whose length can vary)? I have also attached my program with this.
    Attachments:
    retrieve_images_from_DB.vi ‏65 KB
    file_path_to_db_(images).vi ‏40 KB
    create_table_for_images.vi ‏45 KB

    indhu wrote:
    > Thanks for your reply!
    > But my problem is to remove only the last element(which is a tab or an
    > alphabet) from a spreadsheet string of any length.
    If you just want to remove the last character of a string just use the
    String Size function reduce the result by one and wire it together with
    the string to the Split String function.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to check last log backup happend in sql server

    Hi All,
    How to check last log backup happend in sql server
    Thanks in advance
    Shashikala

    Last Tlog Bakcup details
    SELECT
       CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
       msdb.dbo.backupset.database_name,
       MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
    FROM   msdb.dbo.backupmediafamily
       INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
    WHERE  msdb..backupset.type = 'L'
    GROUP BY
       msdb.dbo.backupset.database_name
    ORDER BY
       msdb.dbo.backupset.database_name
    --Most Recent Database Backup FULL for Each Database
    SELECT 
       CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
       msdb.dbo.backupset.database_name, 
       MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
    FROM   msdb.dbo.backupmediafamily 
       INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 
    WHERE  msdb..backupset.type = 'D'
    GROUP BY
       msdb.dbo.backupset.database_name 
    ORDER BY 
       msdb.dbo.backupset.database_name
    http://www.mssqltips.com/sqlservertip/1601/script-to-retrieve-sql-server-database-backup-history-and-no-backups/
    Database -- > Right click -- > Properties -- >
    Raju Rasagounder Sr MSSQL DBA

  • Formula for getting first letter of the string

    Post Author: jmmj
    CA Forum: Formula
    Hi, I have a problem to get the first letter of the string.  I need to compare first letter first and then change the rest of string to number as unit cost for calculation.  For example, I have string K100, C200,...     if first letter = K then 0 else if first letter = C then tonumber200..... I use CRXI, any assistance will be appreciate.jmmj 

    Post Author: jmmj
    CA Forum: Formula
    It works, thanks Kai!But when I tried to print the report, there are multiple lines shown same invoice number but different unit price. My formular is: IF {OEINPR3.COINTYPE} = 2 OR CCur({OEINPR3.LINETYPE}) = 1  //line type 1 for item,  2 for misc. charge THEN(    IF {OEINPR3.COIN}&#91;1&#93; = "K" OR {OEINPR3.COIN}&#91;1&#93; = "N"  THEN        TONUMBER(MID({OEINPR3.COIN},2,20))    ELSE 0)ELSE      2 //for testing only The result I have: Line#    Inv#    unitprice    total1          IN001    0.00     10.00            IN001   10.00     10.00  2          IN002    0.00     20.00             IN002    20.00     20.00.......The second line of each invoice is correct. How can I print just one line for each invoice which is correct? Thanks!jmmj  

  • Deleting the last char of a string

    How can I Delete the last char of a string???
    example:
    asd@fdg@vvdfgfd@gdgdfgfd@gdfgdf@
    I want delete the last @!
    Tks in advance!

    hi,
    try this:
    lv_count = strlen(string).
    lv_count_last = lv-count - 1.
    replace string+lv_count_last(lv_count) in string by ' '.
    This should work.
    thnx,
    ags.
    Edited by: Agasti Kale on Jun 4, 2008 9:03 PM

Maybe you are looking for

  • Windows 8.1 installation query

    I have a original activated version of windows 8... I want to upgrade to windows 8.1 without using app store.. Is it possible that my activated version gets unlicenced if i install the 8.1 iso file..

  • Deleted CDMA USB Modem from Port Configurations... Can't get it back!

    A while back, I was trying out a wireless USB CDMA modem. I didn't really like it and was mainly just using it for testing purposes, and after I was done with it I deleted the port configuration out of my Network Config, thinking A) I'd never need it

  • Intel GMA 945: xrandr trouble

    Hello everyone, I recently observed that when rotating the screen using xrandr -o, it becomes very dark. I'm on a Thinkpad X60 Tablet with Intel GMA 945 and up to date intel driver and Xorg. I have checked this on a laptop of the same model by a frie

  • IMac G5 pre-Intel sleep problem

    I cannot put my iMac to sleep manually by using the toolbar. Have tried reinstalling OSX, and anything I can think of. Any help?

  • My GTX 580 OC will not drop the core clock frequency when idle

    The model is N580GTX-M2D15D5/OC . I have read some reviews said that the GTX580 drops the core clock down to about 50MHz when idle. But my card will always stay at 823MHz. Is this a issue or it's just working as intended? Can i have the clock auto-tu