String regex format

I am stuck....trying to get the input numbers "1" and "0.23" into a string format result as "1:23",but instead I get a result of "1:0.23". getting rid of the "0." from the fractional number....
it must be my regex expression, can this be manipulated using regex without using extra functions? appreciate all the help this forum has given.... 

apok wrote:
RavensFan wrote:
I don't see where you are using a regex.  I see you using a format into string.
Why don't you just multiply the second number by 100 and format that into the string as %0.f;%0.f  ?
well...the string format is time based. Meaning if the fraction is less than 10, I need the "09" (width of 2) to be inplace and not "9" for the seconds. You made a good point in my use of a format function, when I wanted a regex function?
I don't know which you actually want, I'm just commenting on what you are actually using versus what you say you are using.
If the two values are integers, then I would use %d as the format specifier.  If you want it to be a width of 2 padded with zeroes, then it would be %02d.  So I think you actually want "%d:%02d" as your format specifier.  But you can work all that out if you right click the Format into String function and pick Edit Format String.

Similar Messages

  • How can I add three binary numbers and then convert to string (Hex format)?

    Hi All,
    I have my problem "half" resolved, but need some assistance on the final piece.  Overall, I need to take three string values (hex format), convert them to binary, add them and then convert back to a string (hex format).  If that doesn't make sense maybe this will:
    Final Result (My target) = 0xCC
     = 0x03 + 0x01 + 0x04
              = 0x03; 0011b
              = 0x01; 0001b
              = 0x04; 0100b
    For my app, we are dropping "masking" some of the bits so that we get 1 byte:
              = 0x03; 11b
              = 0x01; 001b
              = 0x04; 100b
    So...
    11001100b = 0xCC
    In my VI, I am taking each initial string [0x03,0x01 and 0x04] type casting them to U8.  Next I need to "mask" the binary values as shown above and then add them.  I am not sure how to do this in LV??
    Thanks for the help,
    Bryan

    Hi Bryan,
    there's a conversion palette in the string palette, ever looked at those functions?
    The rest is pure simple math:
    It's the straight-forward way, there are other possibilities too!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • String.class without split(String regex)

    hello,
    This is my problem:
    I am using eclipse with j2sdk1.4.2 which
    implement
    the clase String.class with
    method replaceAll(String regex, String replacement) and
    method split(String regex)
    PAth: home_j2sdk1.4.2/jre/lib/rt.jar 25.762kb
    In this way:
    String columns[] = line.split("\t");
    for (int i=0; i<columns.length; i++)
    ws.addCell(new Label(i,row,columns.replaceAll("\"","")));
    I move the code above to websphere Application Developer 5.1.2
    which use Home_Websphere/eclipse/jre/lib/rt.jar 8.827 kb
    this jar in yours String.class not contains the
    method replaceAll(String regex, String replacement) and
    method split(String regex)
    I need to find the use my code above with that methods,
    what i need to do ???
    possible,i need to find the source to String.java of j2sdk1.4.2
    which implement the methods, but where ???
    or there is another way to do it ???
    Any help is greatly appreciated.

    If websphere is supposedly 1.4 compatible, arethey
    "allowed" to leave out methods from the JFC? Not sure what the JFC is, but no, they would not be
    allowed to leave out any methods.
    JFC - Java Foundation Classes. I think they started calling what might be considered the Java Core the JFC when they first added Swing to the distribution. Maybe the term is no longer used.
    RRD-R      
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Invalid column name in query string - using Format function

    In my post just before this one the problem was solved for writing a query string using a date range. The rest of the query string includes the same date field (Call_Date) but formatted as 'MMM-YY'. I get an invalid column name error when I add this field to the query string. Here is the rest of the query string:
    strSql = "SELECT Format(CALL_DATE,'mmm-yy'), " _
    & "HOME_REGION FROM CCC2.CASE_EPRP " _
    & "WHERE (HOME_REGION = 'NCR') AND " _
    "(CALL_DATE >= to_date( '1/1/2002', 'MM/DD/YYYY' )" _
    & "AND CALL_DATE <= to_date( '2/28/2003', 'MM/DD/YYYY' ))"
    In the Access Query tool I can include this field
    Format(CALL_DATE,'mmm-yy')
    and the query runs fine (I just need to make it dynamic using ADO). But in my ADO query string above, I get the invalid column name error. Is there a way I can include
    Format(CALL_DATE,'mmm-yy')
    in my ADO query string? I appologize for not being more familiar with Oracle Sql. Any help greatly appreciated.
    Thanks again,
    Rich

    Thank you very much for your reply. I think I'm getting closer to the solution. Just I got an error message
    "date format not recognized"
    when I add "to_char( call_date, 'mmm-yy' )" to the query string. I tried using all uppercase, but that did not make a difference. Do I need to use to_date inside the to_char maybe?
    to_char(to_date(call_date, 'mmm/yy'), 'mmm-yy')
    Thanks again for your help.
    Rich

  • How to switch DB string storage format from/to UTF-8 to/from ISO 8859-1 ?

    As far as I understand strings in tables are stored by default in an Oracle DB in ISO 8859-1 format.
    How can I switch the storage to UTF-8 format?
    Do I have to change just a parameter (which ?) or do I have to setup/install the whole DB again?
    If just a parameter switching is necessary:
    How can I change already existing strings from one format to another?
    Does it take place automatically or do I have to issue and explicite convert command (which ?).
    Peter

    Please refer to
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch2charset.htm#sthref157
    And
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch11charsetmig.htm#sthref1476
    Sybrand Bakker
    Senior Oracle DBA

  • String Display Format Specifiers?

    I am aware that numerics have display format specifiers (as shown in picture), but I'm wondering if there's a similar function for getting the display formats of strings?
    I have shown what I want the output to be (although that output was clearly not generated by the code!). So, can I replace the ???'s with some valid format specifiers? 
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

    Thanks for the reply! Well, yes, I'm aware of one "bad" way this can be accomplished, by using the "Text.Text" property of some dummy string indicators:
    Instead, I'm wanting some cleaner syntax. Needing to introduce a dummy indicator just to hijack a property of that object is a bit messy.
    Looking at my example, one might argue "Well you only need one dummy string in a For Loop of 4 iterations, setting the Display Style from 0-3. That way you don't need four dummies." Right, but the principle remains... I'm interested in a Format Specifier (or potentially a VI hidden in vi.lib?) that eliminates the need for a dummy indicator.
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • Paste date in strings in format of mm/dd/yy to Numbers

    I have trouble to paste a list of dates in the format of mm/dd/yy into numbers. For example:
    04/01/10
    04/23/10
    After pasting into Numbers, I got:
    2004-01-10
    04/23/10
    How can I paste a list fo date strings in the format as they are?

    Check your system's date_time setting .
    I guess that it is :
    yyyy/mm/dd
    On my French system, it is dd/mm/yyyy
    so, when I paste your values a I get :
    4 janv. 2010
    04/23/10
    the 1st one is deciphered reversing the day and the month.
    The 2nd remain a string because there is no month #23.
    Yvan KOENIG (VALLAURIS, France) vendredi 23 avril 2010 10:39:07

  • How to convert a xml string html format

    hi,
    in my jso code i have string with name "content", the value of " content" is a xml format.
    so when i type out.print(content)
    i want display it in html format
    can any one help
    thanks

    Use xml parser to read xml elements... then construct Html elements.
    http://www.devx.com/xml/Article/16921

  • Public String[] split(String regex)

    How to change a Logical Operator "|" in regex expression to be treated as a regular character?
    Example:
    public class Temp {
    public static void main (String[] b) {
    String s = "zero|one|two";
    String mac[] = s.split("|");
    System.out.print(mac[2]); //"e" is printed
    Replace "|" with "@" and you will get "two" as output.

    thank you for a quick answer!
    I've changed the line to:
    String mac[] = s.split("\|");
    but i get an error message:
    Temp.java:4: illegal escape character
    String mac[] = s.split("\|");
    ^
    1 error

  • String: Correct format +digits +hyphen

    I have a number in the following format (stored as a String):
    01-000001
    I would like to be able to make sure that above String contains a hyphen in the third character position, the string contains 9 characters total (including hyphen) and that everything except the hyphen is a digit (of numeric value).
    Thanks in advance.

    I have a number in the following format (stored as a
    String):
    01-000001
    I would like to be able to make sure that above String
    contains a hyphen in the third character position, the
    string contains 9 characters total (including hyphen)
    and that everything except the hyphen is a digit (of
    numeric value).
    Thanks in advance.Untested, and not necessarily syntactically correct, but...
    boolean valid = (str.length() == 9);
    if (valid) {
      valid = (str.charAt(2) == '-');
    if (valid) {
      String first2 = str.substring(0, 2);
      try {
        Integer.parseInt(first2);
        String last6 = str.substring(3, 6);
        Integer.parseInt(last6);
      catch (NumberFormatException e) {
        valid = false;
    }

  • Changing hex string display format

    When a string control is in hex display format any data typed is displayed in groups of 2 bytes like AABB CCDD.
    Is there any way to display them in separate group of single bytes like AA BB CC DD?

    Try keeping the discussion in the original thread.

  • [JS - CS4] Help w/ JS choking on quotes in strings & regex

    Does anyone have an easy way to extract text from a string with quotes in JavaScript? I seem to have run into a few limitations in the implementation of javascript's regex and how a script handles a string with quotes in it.
    Here's what I'm working with: a regular string like:
    {appliedParagraphStyle:"Headline 6", changeConditionsMode:1919250519}
    from which I'd like to extract just the text 'Headline 6' without any quotes
    I came across a regex that would get just the text without the quotes, but apparently Javascript does not support lookbacks. For instance, Jongware's wonderful WhatTheGrep script can decode this regex:
    (?<=")[^"]*?(?=")
    but ID finds nothing with it when run in a GREP search. The same search without the lookback finds stuff:
    "[^"]*?(?=")
    but what it finds still has the quote at the start of the string.
    I thought I could just use substrings to extract the text without the quote, but apparently this has issues. See these examples from the Javascript console:
    testStr;
    Result: "Headline 6"
    testStr.length;
    Result: 1
    testStr;
    Result: Headline 6
    testHL.length;
    Result: 10
    testHL;
    Result: "Headline 6
    testHL.length;
    Result: 1
    So if the string has a quote mark in it, it doesn't return the true length, so I can't code a start and end of the string to extract the part without the quote.
    Do any of you more experienced folks have some magic insight? TIA!

    It's an InDesign Oddity.
    Double quotes inside GREP strings behave a bit strange. Usually, the " character will find any sort of double quote -- straight, curly open, and curly closed. But inside a GREP lookbehind string this suddenly fails (in a lookahead it seems to work fine).
    If you replace it with its "forced" variant ~{ it will work on open curly quotes:
    (?<=~{)[^"]*?(?=")
    and if you need it to work on the 'any kind of double quotes' you can even use this:
    (?<=["])[^"]*?(?=")
    But ... all of the above only applies to searching in InDesign! And that's what WhatTheGrep reports upon.
    GREP-inside-Javascript has nothing to do with InDesign's implementation -- it's part of Javascript itself, and it is a completely different thing. (Well, it's still GREP of course. But there is no such thing as "It's still GREP" -- there are lots of different implementations.)
    So it's perfectly possible that this expression works in InDesign but does not work inside Javascript, when applied to Javascript strings. It seems the lookbehind isn't working at all (as it seems you alread found out, uh, on 2nd reading...).
    So you have to think of something else. How about this one? Using parentheses in a find expression can be useful!
    var str = "Hello world!";
    var f = str.match (/"([^"]+)(?=")/);
    if (f)
    alert ("Result: "+f.join("\r"));
    else
    alert ("Nothing matches...");
    str = "Hello \"world\"!";
    f = str.match (/"([^"]+)(?=")/);
    if (f)
    alert ("Result: "+f.join("\r"));
    else
    alert ("Nothing matches...");

  • Possible to capture the delimiter with split(String, regex)?

    If StringTokenizer is frowned on, is it possilble to capture the delimiter in the string array when using split()?

    In Perl, all you have to do is put parentheses around the regex to have the delimiters returned as tokens. I can understand why the Sun devs left that feature out, though: it would make split's behavior twice as confusing as it already is. Anyway, I can't think of a better way to do it than your lookaround method, Sabre.
    If StringTokenizer is frowned on,
    Says who?Says the docs, actually. They say to use split() instead, as if it were a drop-in replacement for StringTokenizer. Then they confuse people even more by implying that split("\\s") is equivalent to the default behavior of StringTokenizer (it should be split("\\s+")). I submitted a bug report about that, but they didn't want to hear it.

  • Oracle connection string - jdbc format

    I'm having issues connecting to an Oracle database from asp.net (C#) - Visual Studio 2013.
    I've installed odp.net and in my project I see references for System.Data.OracleClient (Framework tab) and Oracle.DataAccess and Oracle.Web (Extensions tab).
    Tried all of those, but getting a problem with the connection string.
    Our dbas have given us only one format of connection string that will work, listed below:
    jdbc:oracle:thin:@ldap://oid.inf.mycompany.com:3060/myserviceName1,cn=OracleContext,dc=ute,dc=mycompanyname,dc=com
    This works fine for developers who use Weblogic, but I can't get this to work with C#.
    I put the above value in web.config and use the below code:
    using System.Data.OracleClient;
    //using Oracle.DataAccess.Client;
                    using (OracleConnection conn = new OracleConnection())
                        try
                            conn.ConnectionString = Properties.Settings.Default.sqlConnStr;
                            //SqlCommand cmd = conn.CreateCommand();
                            OracleCommand cmd = conn.CreateCommand();
                            cmd.CommandText = Properties.Settings.Default.sqlQuery1;
                            cmd.CommandType = System.Data.CommandType.Text;
                            //cmd.CommandTimeout = 10;
                            conn.Open();
                            log.Info("Getting local users from db");
                            //SqlDataReader dr = cmd.ExecuteReader();
                            OracleDataReader dr = cmd.ExecuteReader();
                            while (dr.Read())
    using this, I get errors like below:
    System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
    at:
    conn.Open();
    another error seen below:
    System.ArgumentException: Keyword not supported: 'jdbc:oracle:thin:@ldap://oid.inf.mycompany.com:3060/myserviceName1,cn'.
    at: 
    conn.ConnectionString = Properties.Settings.Default.sqlConnStr;
    Even if these errors can be resolved, how would I specify a user id and password for this format of connection string?
    Thanks for any help you can provide,

    Hello simplify,
    For issues regarding Oracle, I would suggest that you could post it to the Oracle forum:
    https://community.oracle.com/welcome
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need some Help ( formating strings vs formatting input files)

    I have a program that reads in a text file and stores each line as a string. The input file has no delimiters and varying amounts of white space. The problem is, I am trying to display each line of the file the same way. Here is an example of what the string looks like when I read it in and then output the strings.
    (I am using the underline to represent white space just in this message post.)
    1.Fred Smith____GA_____23_______42______23.5_____3____5
    2.Jon Doe____SC___42_______3_______39.2_____6_____12
    Now here is is how I would like the output to look like.
    1.Fred Smith_______GA_______23_____42_____23.5_____3_____5
    2.Jon Doe__________SC_______42_____33_____39.2_____6_____12
    Any thoughts or insight on how to achieve this would be great. Thanks for the time.

    Hi, before I'd do anything more complicated, I'd replace some spaces with tabs and see if that does the trick.
    Cheers, HJK

Maybe you are looking for

  • How to create a hyperlink button in an video?

    Hi, Not sure if I'm asking the right question in this discussion room. i saw some YouTube videos. The last frame of the videos have some buttons which direct you to another YouTube video. How can I do that? I don't think FCP will do that. Just wonder

  • Does the Playbook actually have a PHONE feature?

    The new Samsung Galaxy Tab has a phone.  THAT IS LITERALLY THE KILLER APP. Can we design a phone application?

  • 2 Final Questions

    Sorry for all the threads asking questions, im almost set on a Mac Mini. 1. Are there any good torrent clients, such as Bitlord, Bitcomet. And will .torrent files work on Mac, as long as I have a Mac Torrent Client? 2. If I get the wireless keyboard

  • Download Tomcat 5

    I'm new to JSP/Servlet. I would like to know which Tomcat 5 with the extension "exe" and "zip". Which one i should download and what is the different?

  • Copy cost center hierarchy to profit center hierarchy: is this possible?

    Hi, I would like to know or I can copy my standard cost center hierarchy to my standard profit center hierarchy. If so, how to proceed? Thank you in advance, Eric van Zundert. Ps. We do not have enterprise organisastional active.