Convert Array to Proper English?

Here's my problem: I have a bunch of arrays ranging from 2 to
8 members. They look, of course, like this:
"red,green,blue"
but I need to wind up with a string of :
"red, green, and blue"
with a space after each comma and an "and" before the last
member.
Anyone have a good idea on how to do this programmatically,
in a was that I could process any such array from 2 up to 8-10
members? I'm figuring some sort of loop, but my earliest attempts
can get complex and I'm looking for simple.
Thanks.

Thanks for the answer. Someone on another forum was very nice
to share this:
private function arrToEnglishString( _arr:Array ):String {
return _arr.slice(0, -1).join(", ") + ", and
"+_arr[_arr.length-1];
Works quite well!

Similar Messages

  • Converting Array Objects into ArrayCollections

    Hi,
    I am facing problem with converting Array Objects into ArrayCollections. How can i convert Array Objects into ArrayCollections. If any one knows how can we do that Pl reply.
    Thanks in advance to all
    Regards
    subbareddy.p

    Hi Bhasker,
    thanks for u r reply. Here i attached screen shot of my server "data.result".
    My proxy varaible contains
    My object varaible "obj" contains
    After parsing the result my arraycollection contains, (i mean after converting Object to Array to ArrayCollection) the below information. For information Pl find the attached arraycollection.png image. In the attached image my arraycollection name is "users".
    Here i pasted the code that i used  to convert  "ObjectProxy" to "ArrayCollection"
    var proxy:ObjectProxy = ObjectProxy(data.result);
                var obj:Object = proxy.object_proxy::object;
                var arrycoll:Array = ArrayUtil.toArray(obj); 
                model.users = new ArrayCollection(arrycoll);
    Regards
    sss

  • How to convert chinese numbers into english?

    Hi
    I would like to know is there any API or code available to convert Chinese Numbers to English numbers.
    ex: chinese input is 萬一三
    i should convert this to 10013.
    Regards
    Suresh

    I would try using a numberFormat, but I don't know if it can parse a String with chinese characters.
    import java.util.Locale;
    import java.text.NumberFormat;
    NumberFormat formarter = NumberFormat.getInstance(Locale.CHINA);
    int number = formarter.parse(String);

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • Convert array to fewer smaples per second

    Have large array with 9 channels of data per times stamp.
    Timestamp shows that there are about 100 samples per second.
    I need to generate array that only displays one average value per channel, per second.
    Struggling with "build array" and "indexing" to get proper array.
    Suggestions??
    Solved!
    Go to Solution.

    I might even attach the VI this time!! (V 8.6)
    Attachments:
    Array -channel data.vi ‏9 KB

  • How convert to word in English words not code

    How do I convert a PDF file to Word in English? All I get are codes I can't read.

    What means "code"; can you post a screenshot of what you see: https://forums.adobe.com/thread/1070933 - maybe you are not opening the converted document in Word?
    If you want to unsubscribe: http://helpx.adobe.com/x-productkb/policy-pricing/cancel-subscription-acrobat-online-servi ces.html
    [topic moved to ExportPDF forum]

  • To convert special characters to English characters.

    Is there any functional module to convert special characters(Latin) to English characters?

    Hi Meera,
         Welcome To SDN!!
    try using the function module 'SCP_REPLACE_STRANGE_CHARS'.
    Give the variable with special characters in intext.
    Regards
    Kiran Sure

  • Convert different language into english through javascript

    Hi All,
    Is there any way that i can change the language written in textfield of sample pdf template??
    suppose amount in words written in russian language and i want it in english in some other text field is it possible?
    Please reply for this if you have something on this issue
    Regards
    Abhishek

    Hi C,
    Thanks for your reply.
    I would like to know the java script for converting language. If you know the answer then it would be a greater assistance to us.
    Regards
    Abhishek

  • Easier way to convert array to cluster with named variables?

    I have an array of variables, I would like to essentially unbundle that array to named variables.
    I believe the only way of doing this is by converting the array to cluster (besides removing each element one by one)?
    Is what I have done below the best way of doing it? seems a bit weird having to unbundle and rebundle by name.
    comments appreciated.
     

    Your problem code is actually right before the red square. Instead of the "array-to-cluster-unbudle dance", you should simply use a plain index array resized for the same number of outputs. same functionality, less convoluted.
    Your wiring is a bit of a mess and it is hard to tell if the order of elements in the array is the same as in the cluster.  Maybe a simple typecast to the cluster would work.
     

  • Convert data to Proper Case

    Is there a function module, etc. to help convert names, etc. from UPPER CASE to Proper Case existing within SAP already?

    Hi Steve,
                 As far as i know i dont think SAP has a function module for that.
    To convert given string go through this link which uses TRANSFER command.
    [Converting to Upper or Lower Case|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb33a5358411d1829f0000e829fbfe/content.htm]
    Its better you create a function module including this statement as shown in the above link and use it as per your requirement or directly use as stated in the above link.
    Hope this would help you.
    Regards
    Narin Nandivada

  • Convert UPPERCASE to Proper Case

    Hi There,
    I'm jsut wondering how you convert data from all UPPER CASE to Proper case meaning. The first letter of each word is UPPER CASE only.
    First name is: Jennifer
    Last name is: Walsh
    Thanks

    Just be aware that it doesn't work correctly for every name. For example, Lex de Hann would not be capitalized correctly.
    SQL> create table employee(
      2    fname varchar2(30),
      3    lname varchar2(30)
      4  );
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1* insert into employee values( 'JENNIFER', 'WILLIAMS' )
    SQL> /
    1 row created.
    SQL> ed
    Wrote file afiedt.buf
      1* insert into employee values( 'LEX','DE HAN' )
    SQL> /
    1 row created.
    SQL> ed
    Wrote file afiedt.buf
      1* insert into employee values( 'TIM', 'O''REILY' )
    SQL> /
    1 row created.
    SQL> select initcap( fname ),
      2         initcap( lname )
      3    from employee;
    INITCAP(FNAME)                 INITCAP(LNAME)
    Jennifer                       Williams
    Lex                            De Han
    Tim                            O'ReilyJustin

  • How to Convert Latin Character into English

    Hi Experts,
    Can you please suggest how to covert Latin Characters into English like- ó to o, ú to u and so on.is there any FM ??
    Logic: Jesúsó converted to --> Jesuso

    Pre unicode, I used the TRANSLATE statement. Post-unicode, there's no problem with these characters. What are you doing with them that requires the stripping out of accents etc.?

  • How do you convert arabic format to English format in InDesign so bullets are on the left side?

    I received a document from a client to work on that was created in InDesign with english format. For some reason, when they sent it to me the bullets were converted to arabic format, so they are on the left side not right. Is there an easy way to convert it back?

    You will likely get better program help in a program forum InDesign
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Converting Array to ArrayList not working

    Dear Members :
    Following line fails to convert my array to arraylist:
    List myArrayList = Arrays.asList(myArray);
    bcoz when I do
    System.out.println("ArrayList: "+myArrayList);
    it returns [[I@3e25a5]. The array is just a standard array: int[] myArray.
    I even tried with: List myArrayList = new ArrayList(Arrays.asList(myArray)); but same.
    Could you please suggest a solution to this ?
    Thanks in advance.
    Atanu

    YoungWinston wrote:
    Darryl Burke wrote:
    YoungWinston wrote:
    I agree, although experienced programmers would probably realize it already.Varargs existed in Java before I ever started learning it. Today for the first time, I'm beginning to understand why some programming veterans hate the feature.I think it has more to do with the <T> .... (T... array) {in the method signature. Generic types can only be references.Agreed. But it's the varargs that obscure the fact that an <tt>int[]</tt> may be treated as a single <tt>T</tt> parameter while an <tt>Object[]</tt> is treated as a <tt>T...</tt>. Which probably has something to do with the attitude of some veteran programmers to autoboxing as well.
    db

  • Convert UTC in plain English

    Does anyone know how to convert UTC to day, month, and year in plain English?  What I mean is, others have asked this question and received technical responses that call for the use of some ABAP and some functions.  I don't need the ABAP code, I just need to understand it better so I can do a few simple conversions off-line on paper.
    Thanks!

    If you are using iTunes 7 I think this section from the Apple article is pretty straightforward.
    To transfer iTunes Store purchases using iPod:
    Connect your iPod to the computer on which you bought the items you want to transfer.
    Copy the iTunes Store purchases to your iPod.
    Disconnect your iPod (click the Eject button next to its icon) and then connect it to the computer you want to transfer the purchases to.
    Choose File > Transfer Purchases From iPod.
    You could also burn the song files to a data CD or DVD. Once you've burned the disc, take it to your other computer and import the songs into iTunes. Don't forget that regardless of which method you use, both computers have to be authorised to play the songs: About iTunes Music Store Authorisation and Deauthorisation

Maybe you are looking for

  • Satellite A200-20H - No sound after Windows 7 installation

    Hey Guys. I have just bought this computer from a mate, and I have decided to install Windows 7 on the machine. Everything seemed to work brilliant, until I wanted to try and play some sound. There is no sound what so ever on the laptop, all the slid

  • Profit Centre Hierarchy

    Hi, When you do the consolidation by profit center,do you use profit center or profit center group as the cons unit? Thanks in advance

  • Page cannot be displayed after login to applications

    Hi, On trying to login to self services, the browser returns "Page cannot be displayed". I checked the apache error_log and it says File does not exist: /ins01_app01/EUROPA/europacomn/portal/EUROPA_camvmowt2/favicon.ico [Thu Sep 17 03:42:35 2009] [no

  • Problem with weblogic server help me...!

    HI, i have developed and application that was deployed successfully in Tomcat 5.0, but it was not with weblogic 8... plz help me... thanks in advance..

  • Taking my library to my new computer

    hi i have just got a new comp and i want to take my library from my old comp to the new one, if i sync my i-pod to my new comp it wants to wipe all content of my i-pod, there must be an easy way to do this???? can someone help as this is driving me N