Converting Color to string eg "#FFFFFFF" etc

It's possible to convert a string representation to a color by using the Color.decode() method - if I have a color how do I get the string representation?
Thanks
Phil

I don't see anything built into the Color class, but it is pretty easy, I think:    public static String colorString(Color color) {
        return "#" +
                Integer.toString(color.getRed(), 16) +
                Integer.toString(color.getGreen(), 16) +
                Integer.toString(color.getBlue(), 16);
    }Is that what you wanted?
-- Scott

Similar Messages

  • Color from string for settings etc

    This is code to parse a string to color
    used 2 of the popular html formats
    see code at [url src=http://sel2in.com/pages/prog/java/awt/String_Color_Parser.html]http://sel2in.com/pages/prog/java/awt/String_Color_Parser.html
    http://sel2in.com/pages/prog/java/awt/String_Color_Parser.html
    Copyright 2008
    Contact [email protected] http://sel2in.com
    // sel2in.img.dogspa.ImgAdd
    package sel2in.awt;
    import java.awt.color.*;
    import tgk.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import static sel2in.img.dogspa.Consts.*;
    * Parse a string representing a color (RGB with optional alpha) quite like it is in html.
    * @author [email protected] http://sel2in.com Copyright 2008
    public class ColorSetHelper
         public static boolean error = false;
         * Try to parse string as a color else return default passed in.
         * @param s String that should be in format
         * A.  #RRGGBB like #3117A1 or
         * #RRGGBBAA #3117A111 where AA is the alpha component. Each part is 0-255 inclusize or throws an error.
         * B. Another format is rgb(r1, g1, b1) like rgb(45,32, 201)
         * or rgba(45,32, 201, 33) where a is alpha 0 means transparent and 255 means opaque
         * Can also use percentages 0% to 100% :-
         * rgb(r1%, g1%, b1%) like rgb(100%,80%, 90%, 50%) values have to be 0% to 100% inclusive decimels are allowed
         * @param defClr Default Color
         public static Color parseColor(String s, Color defClr){
         public static Color parseHashHexa(String s, Color defClr){
              return c;
         * Testing expects one string value
              rgba(255,7,4,5)
         public static void main(String args[]) {
              ColorSetHelper ap = new ColorSetHelper();
              Color c = ap.parseColor(args[0], Color.white);
              u.sl(c + "\ngetAlpha " + c.getAlpha());
    }what did to you think ?

    no that did not have rgb(100,1,323,100) and rgba(100,1,323,100) type of decleration that my client was used to in html
    last param in rgba is alpha
    yeah i cut when i edited the post wanted to copy to my page (actually needed to copy the source but anyway)
    i wanted to copy it to my web page [http://sel2in.com/pages/prog/java/awt/String_Color_Parser.html|http://sel2in.com/pages/prog/java/awt/String_Color_Parser.html]
    Copyright 2008
    Contact [email protected] http://sel2in.com
    // sel2in.img.dogspa.ImgAdd
    package sel2in.awt;
    import java.awt.color.*;
    import tgk.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import static sel2in.img.dogspa.Consts.*;
    * Parse a string representing a color (RGB with optional alpha) quite like it is in html.
    * @author [email protected] http://sel2in.com Copyright 2008
    public class ColorSetHelper
         * Indicates if last call resulted in error - as the functions dont throw and error and instead return the default
         * This variable is rest at start of every function call. not thread safe.
         public static boolean error = false;
         * Try to parse string as a color else return default passed in.
         * @param s String that should be in format
         * A.  #RRGGBB like #3117A1 or
         * #RRGGBBAA #3117A111 where AA is the alpha component. Each part is 0-255 inclusize or throws an error.
         * B. Another format is rgb(r1, g1, b1) like rgb(45,32, 201)
         * or rgba(45,32, 201, 33) where a is alpha 0 means transparent and 255 means opaque
         * Can also use percentages 0% to 100% :-
         * rgb(r1%, g1%, b1%) like rgb(100%,80%, 90%, 50%) values have to be 0% to 100% inclusive decimels are allowed
         * @param defClr Default Color
         public static Color parseColor(String s, Color defClr){
              error = false;
              if(s==null || s.length() < 3)return null;
              if(s.charAt(0) == '#'){
                   return parseHashHexa(s, defClr);
              StringTokenizer st = new StringTokenizer(s, " ,()");
              //rgba(1,4,2,4)
              String typ = "rgb";
              //boolean alpha = false;//not used works well with both
              if(st.hasMoreTokens()) typ = st.nextToken();
              //if(typ.endsWith("a"))alpha = true;
              int r = 0, g = 0, b = 0 , a = 255;
              Color c = defClr;
              try{
                   if(st.hasMoreTokens()){
                        s = st.nextToken();
                        if(s.endsWith("%")){///**/""
                             s = s.substring(0, s.length() -1);
                             r = (int)(Integer.parseInt(s) * 255 / 100);
                        }else{
                             r = Integer.parseInt(s);
                        if(st.hasMoreTokens()){
                             s = st.nextToken();
                             if(s.endsWith("%")){
                                  s = s.substring(0, s.length() -1);
                                  g = (int)(Integer.parseInt(s) * 255 / 100);
                             }else{
                                  g = Integer.parseInt(s);
                             if(st.hasMoreTokens()){
                                  s = st.nextToken();
                                  if(s.endsWith("%")){
                                       s = s.substring(0, s.length() -1);
                                       b = (int)(Integer.parseInt(s) * 255 / 100);
                                  }else{
                                       b = Integer.parseInt(s);
                                  if(st.hasMoreTokens()){
                                       s = st.nextToken();
                                       if(s.endsWith("%")){
                                            s = s.substring(0, s.length() -1);
                                            a = (int)(Integer.parseInt(s) * 255 / 100);
                                       }else{
                                            a = Integer.parseInt(s);
              }catch(Throwable e){
                   u.sl(e, e);
                   error = true;
              try{
                   c = new Color(r, g, b, a);
              }catch(Throwable e){
                   error = true;
                   u.sl(e, e);
              return c;
         public static Color parseHashHexa(String s, Color defClr){
              error = false;
              int r = 0, g = 0, b = 0 , a = 255;
              Color c = defClr;
              try{
                   r = Integer.parseInt(s.substring(1,3), 16);
                   g = Integer.parseInt(s.substring(3,5), 16);
                   b = Integer.parseInt(s.substring(5,7), 16);
                   if(s.length() > 7)a = Integer.parseInt(s.substring(7, 9), 16);
              }catch(Throwable e){
                   error = true;
                   u.sl(e, e);
              }finally{
                   try{
                        c = new Color(r, g, b, a);
                   }catch(Throwable e){
                        error = true;
                        u.sl(e, e);
              return c;
         * Testing expects one string value
              rgba(255,7,4,5)
         public static void main(String args[]) {
              ColorSetHelper ap = new ColorSetHelper();
              Color c = ap.parseColor(args[0], Color.white);
              u.sl(c + "\ngetAlpha " + c.getAlpha());
    }

  • Converting a given string to non-english language

    {color:#0000ff}Hi can anybody help me how to convert an entered string in textfield to french or spanish or to anyother non-english language?{color}

    Hi,
    I don't think you get a language translator package.
    What you can do is store the fraises, words in a database.
    //SQL Code
    CREATE TABLE [Language_Data]
      [ID]    INT NOT NULL IDENTITY PRIMARY KEY,
      [Lang]  VARCHAR(30) NOT NULL,                             //Lang English/French.....
      [Type]  CHAR(1) NOT NULL,                                 //is Fraise or Word
      [Words] VARCHAR(100) NOT NULL                             //Fraise or Word data
    GO
    CREATE TABLE [Translate]
      [ID]       INT NOT NULL IDENTITY PRIMARY KEY,
      [FK_Orig]  INT NOT NULL REFERENCES [Language_Data]([ID]), //ID of the original language
      [FK_Trans] INT NOT NULL REFERENCES [Language_Data]([ID])  //ID's for all known translations
    GO Create Stored procedures to add a new word/fraise to the [Language_Data] table,
    Create a Stored Procedure to add a translation to the [Translate] table
    Please note that to add a translation you will first insert into the [Language_Data] table then
    insert the original's ID and the translation ID to the [Translate] table Also make prevision for backwards translation

  • Convert Raw Binary String to InputStream

    Hi i want to upload a {color:#003366}JPG image file{color} in a {color:#003366}BLOB{color} field in database. At first i was using {color:#003366}AJA{color}X to send file {color:#003366}path{color} to the {color:#003366}servlet{color} creating a {color:#003366}file Object{color} from it, then {color:#003366}FileInputStream{color} from it, and finally passing it to {color:#003366}preparedstatement.setBinaryStream({color}) method. It worked great. But since{color:#003366} Firefox 3{color} stopped sending full path to database i have to use another method.
    So instead of sending image path i used {color:#ff0000}nsIDOMFile{color} property of Firefox 3. It has a method {color:#003366}getAsBinary(){color} which Returns a DOMString containing the file's data in {color:#003366}raw binary{color} format. Now i access this {color:#003366}string{color} from servlet using{color:#003366} request.getParameter(){color} method which creates a {color:#003366}String containing bit code of the image file{color} (I suppose). Now how to convert this string to {color:#003366}InputStream{color} so that i can store this in BLOB field in database using prepared statement.
    Right now I am using following code but it doesn't seem to work.
    String image=request.getParameter("image");
        try{
          InitialContext context = new InitialContext();
          dsource = (DataSource)context.lookup("java:comp/env/jdbc/DataSource");
          con = dsource.getConnection();
          ps = con.prepareStatement("SOME STATEMENT");
          ByteArrayInputStream imagestream = new ByteArrayInputStream(image.getBytes());
          ps.setBinaryStream(1, imagestream, imagestream.available());
          int i = ps.executeUpdate();Edited by: Wonder01 on Oct 22, 2008 12:24 PM

    Yeah i came across that too. But these show either iframes hack method (which really isn't ajax) or else writing large pieces of code just to generate the binary stream of the file, then manually creating multipart/form-data request were the only options until Firefox 3 introduced nsIDOMFile. See this and read first few lines (you'll understand what i mean). So i send request in the form of a parameter containing Raw Binary format of the file
    Now going over to the servlet side i need to somehow accept this parameter and insert in database. First i need to know how should i receive this on servlet (By using request.getParameter() or some other method). And secondly, how to convert that to either a byte array or InputStream. I searched for it and think this might be useful. This page shows 1.) how to convert an array of raw binary data into an array of ASCII 0 and 1 characters and 2.) how to convert a String to byte array where each char of the String represents an ASCII '0' or '1'. But what i nedd is slightly different, I need to convert a String containing Raw Binary into byte array.
    And thanks for the information on the file paths. It was really helpful

  • ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtFetch

    Hi all,
    We are trying to create a BIP Data Model based on an Answer, but after selecting report, it hangs when I try to Apply to create a query based on Oracle BI. When I try to open the query in aswers, going to results tab I'm getting this error (OBIEE 11.1.1.6.2):
    ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtFetch
    I suppose that BIP data model is not able to create it because of this error. But this answer is working fine inside dashboards, etc. It only does not work when editing it. Query is doing something like this: "USING "- Collection Attributes"."Due Date" >= TIMESTAMPADD(SQL_TSI_DAY, -30, CAST ('01/04/2009' AS DATE))"
    Any ideas?

    Solved watching date format in generated SQL and changing default date format in presentation variables default values inside criteria according to SQL format.

  • Date time characteristic converted in a string in Universe OLAP

    Hi there,
    We are facing to the following issue. Maybe one of you has been already facing to.
    We have created a BO universe on top of BI queries (based on MDX) and we make WEBI reports.
    We note when we update/refresh the OLAP structure, all characteristics (Number and date) are converted/considered as a character and string and we loose in that way the time information.
    This is very ennoying when sorting on time dimensions as WEBI can only sort on Alphabetic order.
    Indeed, we would like to display the last 13 month of a key figure as from the last month.
    As the time characteristic is automatically converted by the Olap refresh structure in a string, we can't display the last 13 months in logical/natural/calendar order.
    Ex: NOV 2007 | DEC 2007 | JAN 2008 | FEB 2008 ....DEC 2008
    Any idea :
    - why the 'Refresh structure' command automatically convert into a string?
    - how to force him not to convert to string and keep the date information?
    - order date as the logical/natural/calendar one?
    Beforehand, thanks a lot

    Hi Ingo,
    I'm using 0CMonth or 0CALMONTH which are SAP characteristics.
    Do you know how to sort data by date and not by string?
    When we recuperate infoobejcts from BI queriies, all objects are string and all LOV are sorted by string which don't help us.
    imagine we have JAN 1996, JAN 1997,... FEB 1996 etc etc.
    A nightmare
    Laurent

  • Problem with JTree converting Node to string

    I have a problem that I cannot slove with JTree. I have a DefaultMutalbeTreeNode and I need its parent and convert to string. I can get its parent OK but cannot convert it to string.
    thisnode.getParent().toString() won't work and gives an exception
    thisnode.getParent() works but how do I convert this to string to be used by a database.
    Thanks
    Peter Loo

    You are using the wrong method to convert it to a String array.
    Try replacing this line:
    String[] tabStr = (String[])strList.toArray();
    With this line:
    String[] tabStr = (String[])strList.toArray( new String[ 0 ] );
    That should work for you.

  • Is there an easy way to convert a long string into an array?

    I can convert a long string into a 1-d array by parsing and using build array, but I would like to know if there is a function to make this easier.
    For example:
    from/   aaaaaaaabbbbbbbbccccccccdddddddd         (string of ascii)
    to/       an array that is 1-d with each element having eight characters
              aaaaaaaa
              bbbbbbbb
              cccccccc
              dddddddd
    Thank you.
    Solved!
    Go to Solution.

    Try something like this:
    (If you can guarantee that the string length is an integer multiple of 8, you an drop the two triangular modes in the upper left. )
    Message Edited by altenbach on 03-14-2010 06:40 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChopString.png ‏9 KB

  • Need a function module to convert xstring to string in web dynpro applicati

    hi,
       need a function module to convert xstring to string in web dynpro application other than HR_KR_XSTRING_TO_STRING.
    Moderator message: please (re)search yourself first.
    Edited by: Thomas Zloch on Nov 17, 2010 5:31 PM

    Hi,
    Check the following link:
    FM to convert XString to String
    Regards,
    Bhaskar

  • Convert Color PDF to Grayscale using Preflight in Acrobat 9 Pro

    Has anyone posted a step-by-step procedure to convert color PDFs to grayscale? I've unsuccessfully been trying to use the new Preflight dialog to do this. This is the procedure I tried:
    1) In the Preflight dialog, Create New Preflight Fixup.
    2) Fixup Category: Color Spaces, Spot Colors, Inks. For Type of Fixup: Convert Colors.
    3) In the Conversion settings tab, chose All Objects, Using Any Color (except spot colors), plus All Objects, Using Spot colors(s).
    4) For Destination, I chose a grayscale destination Dot Gain 25%.
    5) After clicking OK, I selected the new profile and clicked on the Fix button, and saved the file.
    Nothing happens, and the colors don't change.
    If anyone can explain what I'm missing, I would greatly appreciate it.

    Refer to Acrobat 9 Help PDF (installed with Acrobat 9 is installed).
    Review the  discussion for Exporting PDFs in Chapter 5 of this Help PDF.
    The PDF is also available on Adobe's site.
    http://help.adobe.com/archive/en_US/acrobat/9/professional/acrobat_pro_9.0_help.pdf 
    Good to know is that the Acrobat 9.x product family passed into End of Support mid-year 2013.
    Be well...

  • How I can access "Convert Colors..." button in Adobe Acrobat XI using applescript, or add this button to menu bar?

    Hi, I'm writing applescript to automate Adobe Acrobat XI, I'm missing only one line of code - opening dialog window of "Convert Colors..." tool. It was easy in Acrobat 9 but some reason it's complicated in Acrobat XI.
    Is there an option to add "Convert Colors..." as menu item into menu bar?

    Thanks Gilad D. I created JS file with simple code
    app.addMenuItem({cName:"Convert Colors", cParent:"View", cExec:'app.execMenuItem("ColorConversionMenuItem");'});
    and I added it into acrobat (USER/Library/Application Support/Adobe/Acrobat/11.0/JavaScripts/).
    I enabled menu items JavaScript execution privileges in Acrobat Preferences.
    Now I can open "Convert Colors" from main menu bar, and create applescript which do the same.

  • Converting Datetime in String in map

    Hello all,
    I am reciving a message from a system A, in which I am receiving field DOB as datetime and I am sending same message to system B , problem is that system B not able to handle DOB at there end as datetime - I have checked at BizTalk side that DOB
    is going correct so issue is at system B side. now system B wants BizTalk system to send them DOB field as string.
    What could be the possible way's to do this ?
    1) We can change both schema System A schema and System B schema and map them is one way .
    2) Can we take datetime and convert it to string using some funtoid ? and send that string to system B ? How ?
    Is there other way for this ?
    Thanks,
    Nitin
    Thanks and Regards, Nitin.

    Hi Nitin,
    First find out how the destination system consumes the datatime value. Some system would consume the value in the datetime field as string. It could be the problem in the format of the datetime. Ask them about their expected datetime format. For example
    "2004-09-23T10:20:00.000-05:00" is the standard datetime format produced when you set a field as xssd:datetime. May be the destination system not able to handle this format.
    If the issue is in the datatype i.e. in the way client consume, the datatype of the destination schema matter:
    Then update the destination schema's to have string datetype. And simply map the value from the soruce's datetime field to destination schema's update string field. You don't need any scripting fuctiond to convert the data type. BizTalk's mapper would handle
    it.
    If the issue is in the date format  i.e. in the way client consume, the datatype of the destination schema doesn't matter, and if the actual problem is in the format:
    Then update the destination schema's to have string datetype. Use a scripting fuctiond as suggested by others and do the conversion in the script.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Help with Sample on Converting an XML string to a byte stream

    Hello All,<br /><br />I am sure this is something simple, but I am just not figuring it out right now.<br /><br />I am following the sample - "Converting an XML string to a byte stream" from the developer guide since I want to prepopulate just 1 field in my PDF form.<br /><br />How do I reference my form field within my servlet code properly??<br /><br />I have tried a few things now, my field is within a subform, so I thought it would be <root><subformName><fieldname>My data</fieldname></subformName></root>  I have also tried adding <page1> in there too.<br /><br />I am following everything else exactly as given in the sample code.<br /><br />I do have an embedded schema within the form and the field is bound.<br /><br />Thanks,<br />Jennifer

    Well, if you have a schema defined in the form, then the hierarchy of your data must match what is described in the schema. So, can't really tell you what it would look like, but just follow your schema.
    Chris
    Adobe Enterprise Developer Support

  • CIN: Converting a C String to a LabVIEW String

    Hi all,
    I have been developing CINs in Microsoft Visual C++ 6.0 for LabVIEW as
    project needs. However, I am having a problem with converting a C String
    to a LabVIEW String in CIN.
    I used two ways to try to make the conversion work that were LStrPrintf
    and MoveBlock as stated as following:
    1. LStrPrintf
    #include "extcode.h"
    #include "hosttype.h"
    #include "windows.h"
    struct teststrct{
    const char* test;
    struct teststrct testinstance;
    typedef struct {
    LStrHandle test
    } TD1;
    CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
    char *tempCStr = NULL;
    strcpy(tempCStr, testinstance.test); // this would cause LabVIEW crash!
    LStrPrintf(testcluster->test, (CStr) "%s", tempCSt
    r);
    // but if I assigned tempCStr as tempCStr = "test", the string value
    "test" could be passed to LabVIEW without any problems.
    2. MoveBlock
    #include "extcode.h"
    #include "hosttype.h"
    #include "windows.h"
    struct teststrct{
    const char* test;
    struct teststrct testinstance;
    typedef struct {
    LStrHandle test
    } TD1;
    CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
    char *tempCStr = NULL;
    int32 len;
    tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
    used this way to try to copy the const char* to char*.
    len = StrLen(tempCStr);
    if (err = NumericArrayResize(uB, 1L, (UHandle*)&testcluster->test,
    len))
    *Error = LVFALSE;
    goto out;
    MoveBlock(&tempCStr, LStrBuf(*testcluster->test), len); // the string
    was able to passed to LabVIEE, but it was unreadable.
    out:
    Did I do anything wrong? Any thougths or suggestions would be very
    appreciated!

    Thank you so much for your response, Greg. However, I still have problem after making
    corresponding modification for LStrPrintf approach:
    int32 len;
    char tempCStr[255] = "";
    strcpy(temCStr, testinstance.test);
    len = StrLen(tempCStr);
    LStrPrintf(testcluster->test, (CStr) "%s", tempCStr);
    LStrLen(*testcluster->test) = len;
    LabVIEW crashes. Any ideas?
    Greg McKaskle wrote:
    > The LStrPrintf example works correctly with the "test" string literal because
    > tempCStr= "test"; assigns the pointer tempCStr to point to the buffer containing
    > "text". Calling strcpy to move any string to tempStr will cause
    > problems because it is copying the string to an uninitialized pointer,
    > not to a string buffer. There isn't anything wrong with the LStrPrintf
    > call, the damage is already done.
    >
    > In the moveblock case, the code:
    > tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
    > used this way to try to copy the const char* to char*.
    >
    > doesn't copy the buffer, it just changes a pointer, tempCStr to point to
    > the testinstance string buffer. This is not completely necessary, but
    > does no harm and is very different from a call to strcpy.
    >
    > I believe the reason that LV cannot see the returned string is that the
    > string size hasn't been set.
    > Again, I'm not looking at any documentation, but I believe that you may
    > want to look at LStrLen(*testcluster->test). I think it will be size of
    > the string passed into the CIN, and it should be set to len before returning.
    >
    > Greg McKaskle
    >
    > > struct teststrct{
    > > ...
    > > const char* test;
    > > ...
    > > };
    > >
    > > struct teststrct testinstance;
    > >
    > > typedef struct {
    > > ...
    > > LStrHandle test
    > > ...
    > > } TD1;
    > >
    > > CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
    > >
    > > char *tempCStr = NULL;
    > >
    > > ...
    > >
    > > strcpy(tempCStr, testinstance.test); // this would cause LabVIEW crash!
    > > LStrPrintf(testcluster->test, (CStr) "%s", tempCStr);
    > > // but if I assigned tempCStr as tempCStr = "test", the string value
    > > "test" could be passed to LabVIEW without any problems.
    > >
    > > ...
    > > }
    > >
    > > 2. MoveBlock
    > >
    > > #include "extcode.h"
    > > #include "hosttype.h"
    > > #include "windows.h"
    > >
    > > struct teststrct{
    > > ...
    > > const char* test;
    > > ...
    > > };
    > >
    > > struct teststrct testinstance;
    > >
    > > typedef struct {
    > > ...
    > > LStrHandle test
    > > ...
    > > } TD1;
    > >
    > > CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
    > >
    > > char *tempCStr = NULL;
    > > int32 len;
    > > ...
    > >
    > > tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
    > > used this way to try to copy the const char* to char*.
    > > len = StrLen(tempCStr);
    > >
    > > if (err = NumericArrayResize(uB, 1L, (UHandle*)&testcluster->test,
    > > len))
    > > {
    > > *Error = LVFALSE;
    > > goto out;
    > > }
    > >
    > > MoveBlock(&tempCStr, LStrBuf(*testcluster->test), len); // the string
    > > was able to passed to LabVIEE, but it was unreadable.
    > > ...
    > >
    > > out:
    > > ...
    > >
    > > }
    > >
    > > Did I do anything wrong? Any thougths or suggestions would be very
    > > appreciated!

  • Converting a binary string to a number...

    Hi guys,
    I'm trying to convert a binary string into a decimal integer. I'm not sure if LabVIEW has a VI that does that. I haven't found one yet. Basically, say I have the string '0101'. I want to convert that to the value '5'. Or say I'm using hex, I want '10101111' to be converted to 'AF'. So that's my dilemma. I'm hoping I'm not going to have to make my own VI. Thanks a lot!
    -Mike

    LabVIEW has exactly what you want even if it can be hard to find it.
    To convert a binary text string like "0101" to a decimal value can easily be done using the Scan Value function found under the String/Number conversion section. If you provide the format %b to it (not mentioned in the manual) you will get the decimal value of your binary string.
    Also, on your front panel you can change the format of your numerical indicators by right clicking on it and selecting Format & Precision. If you have a numerical indicator you can set it do display the numbers in e.g. hexadecimal form.
    However, if you want to convert a number to a hexadecimal text string you can use the Number to Hexadecimal String function also found under the String/Number conversion section.
    I
    attached a simple example, Conversions.vi, that shows how it works. I hope this helps. /Mikael
    Attachments:
    conversions.vi ‏14 KB

Maybe you are looking for