String Split and join

Hi all.

I have a form with a TextBox for the display name and I want the fist letter capitalized in the first and last name.

I have a function for it and everything works fine, the problem comes when there is a hyphen "-" in the name. I work part of split, but I can't make it work on the side of the join.

function ucFirstAllWords( str )
{
          var pieces = str.split(" "); //use this for space and "-" split (/[ \/-]/);
    for ( var i = 0; i < pieces.length; i++ )
    {
        var j = pieces[i].charAt(0).toUpperCase();
        pieces[i] = j + pieces[i].substr(1);
    }
    return pieces.join(" ");
}

If I use this code and slpit on the hyphen and space all get the join with the space, I tyed to do a function in function to capture the first hyphen, but that did not work probably hurting

Does anyone have an idea how to fix?

I am on LK 8.0

Thank you.

Fredrik Nordstrand, Sweden

Hi Scott.

I want to 'john doe' to be "John Doe" and 'Rose of ann-lee' to be 'Ann - Lee Rose Bush.

Make any sense?

Woks fine scrip but not with a name that contains a hyphen.

If I use the split to include the hyphen "ann-lee" would become "Ann Lee" and that's not true.

Tags: Adobe LiveCycle

Similar Questions

  • BUG: Split then join reverse byte order - sometimes

    I created a simple to serialize an array of bytes I32 and fell VI on this interesting bug. This code runs in 32-bit SP1 of LabVIEW in 2014, fully patched. Save the parts two attached and run TestI32ToByteArray.vi. Note that the 6 and 7 at the end of the table are reversed. If you explore the data around, everything looks good except the string split on the last low word is reversed. Any ideas?

    More details on the installation program:

    LabVIEW 2014 SP1 32-bit

    AMD FX - 6300 3.5 GHz processor hexagonal

    Windows 7 64 - bit, fully patched

    8 GB RAM

    Check your wiring, 6 is connected to a lower bound of the join, and 7 is wired to the top.

  • issue of String.Split("")

    Hi you

    I have a string that contains a name entry, and I care about them overturned in 2 parts and the record within a table, the first name and last name.

    How do with string.split?

    My current code is

    myNameArray = str_adminInput.split("");

    This code only works if the names are: Jack Lee, June Poh.

    This code does not work if the names are: Lee Tok Kong, Tan Beng Seng.

    How to solve this problem?

    -Zainuu

    I think you can do this:

    var firstname:String = str_adminInput.substring (0, str_adminInput.indexOf(""));

    var secondname:String = str_adminInput.substring (str_adminInput.indexOf(""), str_adminInput.length);

    myNameArray = new Array (firstname, secondname);

  • Best way to transfer strings, arrays and clusters

    Hi, I just want to know the best way to transfer strings, arrays and clusters between a PC and a computer-RT (compactRIO) if I want to use them in deterministic loops:

    For a string should I use a published network shared variable flow or network?

    For an array of doubles should I flatten the array in a string and the string of transfer? or should I send it as a picture?

    The same for clusters, should I flatten the cluster or the transfer as a cluster?

    Thank you!

    Transfers on the network are not deterministic.  You ask how to use the data in a deterministic way, once it arrives on the RT system.  Usually, you would create a separate loop, not critics of time to deal with network communications.  The data arrives it is copied in real-time-safe structures such as RT-FIFO to put at the disposal of the evanescent loop.

    I can't give you specific advice on network variables and network flows; Finally, I did this kind of transfer over TCP, until these other options were available.

  • I am locked into a widows 2000 operating system after an inept tech tried it sever the domain and join it.

    Technician tried to delete the computer account on the domain and join it. It works well with Windows XP and win7. Now it comes to the administrator login and does not allow me to use the admin password.  I need to enter this computer because it is an old autocad computer with lots of files which are still on the machine.

    Hello silvrfox,

    The Microsoft Answers community focuses on issues and problems related to the consumer environment. Please join the public IT pro TechNet forums below:
    TechNet - Windows Server
     
    Thank you

  • The PC shows it belongs to a homegroup, but when I try and join the laptop to the Homegroup PC, following the instructions, including the seizure of the password, it fails.

    I have two computers in a small home network, both running Windows 7. A laptop and the other a PC. The two appear in the network on each computer. The PC shows it belongs to a homegroup, but when I try and join the laptop to the Homegroup PC, following the instructions, including the seizure of the password, it fails. I want to share photos, files and documents, etc.

    Any ideas.

    Original title: homegroups

    Read this discussion and see if it helps you:
    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-networking/HomeGroup-cannot-figure-out-how-to-share-files/f2ee4a6b-1540-4894-8a80-15168e55fc83>

    Here is another method that doesn't use homegroup. I've used this between two machines of Win7 and between Win7 and Win8 machine, as well as the topic Win7 and WinXP. I am frustrated with Group residential everything and currently have disabled entirely.
    http://www.howtogeek.com/HOWTO/Windows-7/share-files-and-printers-between-Windows-7-and-XP/>

    SC Tom

  • could not find a server reports and analysis hyperion running on localhost port 6800. Please check your connection string server and verify that the server is

    Hi all

    We have properly installed and configured Hyperion Reporting and analysis 11.1.2.4 in windows 2012 server however when I try to logint to the workspace, I get an error like "start-up of the specified document does not exist in the repository." "Select a new start under the General Preferences tab document" monitoring of "could not find a server reports and analysis hyperion running on localhost at port 6800. Please check your connection string server and verify that the server is up '.



    10.PNG


    11.PNG

    HyS9RaFramework_epmsystem2-syserr:

    GsmNotFound

    com.brio.one.services.globalservicemanager.GSMException: GsmNotFound

    at com.brio.one.services.globalservicemanager.GSMFactory.getGSM (unknown Source)

    to com.brio.one.client.ClientFactory. < init >(Unknown Source)

    to com.brio.one.client.ClientFactory. < init >(Unknown Source)

    to com.brio.one.client.ClientFactory$ ClientFactoryInitializer.connect (unknown Source)

    at com.brio.one.client.ClientFactory.getClientFactoryConnect (unknown Source)

    at com.brio.one.client.ClientFactory.getDefaultGSM (unknown Source)

    at com.brio.one.web.properties.ApplicationProperties.getDefaultGSM (unknown Source)

    at com.brio.one.web.properties.ApplicationProperties.getDefaultGSMContext (unknown Source)

    at com.sqribe.WS.WSBaseServlet.setDefaultGSMContext (unknown Source)

    at com.sqribe.WS.WSBaseServlet.initLogging (unknown Source)

    at com.sqribe.WS.WSBaseServlet.loadConfiguration (unknown Source)

    at com.sqribe.WS.WSBaseServlet.init (unknown Source)

    to weblogic.servlet.internal.StubSecurityHelper$ ServletInitAction.run (StubSecurityHelper.java:283)

    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)

    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)

    to weblogic.servlet.internal.StubLifecycleHelper. < init > (StubLifecycleHelper.java:48)

    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)

    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1981)

    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1955)

    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1874)

    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3155)

    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)

    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:487)

    to weblogic.application.internal.flow.ModuleStateDriver$ 3.next(ModuleStateDriver.java:427)

    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:201)

    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:249)

    to weblogic.application.internal.flow.ModuleStateDriver$ 3.next(ModuleStateDriver.java:427)

    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:28)

    to weblogic.application.internal.BaseDeployment$ 2.next(BaseDeployment.java:672)

    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)

    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:59)

    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)

    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)

    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)

    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)

    to weblogic.management.deploy.internal.DeploymentAdapter$ 1.doActivate(DeploymentAdapter.java:52)

    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)

    to weblogic.management.deploy.internal.AppTransition$ 2.transitionApp(AppTransition.java:31)

    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:261)

    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:246)

    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:170)

    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:124)

    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:181)

    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:97)

    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)

    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

    In the workspace, it shows that the Service is pending.

    14.PNG

    EMP Diagnostic Report:

    13.PNG

    Can help kindly out how should I solve this problem.

    I restarted the services and rebooted the Machine but still getting the same error.

    Kind regards

    VJ


    Hello

    I've reconfigured the Reporting, analysis, and everything by, I chose "Drop table" and the issue was resolved.

    Kind regards

    VJ

  • How String concat and number?

    This is my code:

    PMString strLabel is 'TXT-' + 1;.

    But result = 'TXT '.

    How String concat and number?

    Hi daitranthanhoa,

    PMString has an AppendNumber function.

    Markus

  • How to get the part of string before and after a character

    Hi all

    How to get the string before and after the comma character)

    Ex: The string contains the value John Kennedy

    I need the output as first stirng - John

    Second stirng - Kennedy

    Create table names (fullname varchar2 (20));

    insert into values of names ("John, Kennedy");

    insert into values of names ("papa ibra, Shan");

    insert into values of names ('Don Bosco'),

    Select * from names;

    Expected results

    FullName firstname lastname

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    Please let me know how to proceed

    Thank you

    Hello

    This proves what I said before, on 0 and several commas commas.

    If we add these 3 rows to the sample data you posted:

    insert into names (fullname) values ("tou").

    insert into names (fullname) values (' David, Lloyd, George ");

    insert into names (fullname) values ('J, R, R, Tolkien");

    then the query I posted earlier produced these results:

    FULLNAME FIRSTNAME LASTNAME

    -------------------- -------------------- --------------------

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    TOU tou

    David Lloyd, George David Lloyd, George

    J, R, R, Tolkien J R, R, Tolkien

    If you prefer to get these results:

    FULLNAME FIRSTNAME LASTNAME

    -------------------- -------------------- --------------------

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    TOU tou

    David Lloyd, George David, Lloyd George

    J, R, R, J, R, R Tolkien Tolkien

    then you just change line 1:

    WITH got_commapos AS

    (

    SELECT FullName

    , INSTR (fullname, ','-1) AS commapos-* CHANGED *.

    Names

    )

    SELECT FullName

    , SUBSTR (fullname, commapos 1, -1) AS a first name

    SUBSTR (fullname, commapos + 1) in the FORM name

    OF got_commapos

    ;

  • With the last update, I am unable to merge cells in a table and Ive tried Split and Live view.

    With the last update, I am unable to merge cells in a table and Ive tried Split and viewing live, all the tutorial and manuals say to do in Design view, which is no longer available.  How to merge cells in a table now?

    To get the fashion Design back in a checkerboard to fluid...

    Close all other files, open the fluid grid css and add the X below:

    /*

    Properties Grid Dreamweaver fluid

    ----------------------------------

    DW-num-CLO-mobile: X 4;

    DW-num-CLO-Tablet: 8;

    DW-num-OCOL-Office: 12;

    DW-gutter-percentage: 25;

    =====================================

    Then save and close the file.

    DW restart and you should have mode Design from here out on all files using this fluid grid .css file.

  • I need to cancel my current subscription and join the agreement through my school - Virginia Tech

    How can I cancel my current contract of creative cloud and join the offer and the agreement of Virginia Tech, while having waived cancellation fees?

    Hello

    Please contact support by calling/chat for cancellation requests and billing queries:

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    Kind regards

    Sheena

  • I canceled my account same day and join as convert PDF word has not converted correctly how to get credit for membership cancellation

    I canceled my account same day and join as convert PDF word has not converted correctly how to get credit for membership cancellation

    You need to contact Adobe customer service:

    They will check and help you. (Live chat)

    Contact the customer service

  • In case assistance and joins in the update statement

    Hi all
    I need to update a column in my table... but we must make case and joins... I wrote the application and it does not work
    I get a msg of error saying... the command SQL not completed correctly...
    I'm not good at SQL... Help, please...

    Update t1 a
    Set a.name2 =
    (case
    When "1" then b.msg2 ("bingo")
    When b.msg2 in ("andrew"), then "2"
    When b.msg2 in ('sam') then "3"
    else ' 4'
    end)
    T1 left outer join t2 b
    We a.name1 = b.msg1;

    Waiting for the help on this...!
    Thanks in advance... :)

    Please try this one I posted just to the top message from William.

  • String equals and == difference...

    Hi all

    According to my understanding is equal to string corresponds to the string value and 'is' corresponds to objects represented on each side of the operator. but I saw a strange behavior while playing with these String API.

    class StringTest1
    {
    Public Shared Sub main (String [] args)
    {
    Ja string = "Ja".
    String's = "go";

    Java2 string = "Java";
    String java1 = ja + is going;
    String java1 = "Java";

    System.out.println ("is equal to:" + (java1.equals (java2)));
    System.out.println ("==:" + (java1 is java2));
    }
    }

    For the code above I get the output as 'true' for the first and 'false' for the second expression. output equal to equal is fair enough, but for the operator "is" its fake giving that according to my thinking should be true as says the chain worn No. TWO CHANNELS WITH SAME VALUES funda.
    Among the 2 variables java2 is a string 'Java' and java1 is the result of the concatenation smthing like 'Ja' + 'goes '.

    I tried to do something like
    System.out.println ("obj1:" + java1.hashCode ());
    System.out.println ("obj1:" + java2.hashCode ());
    BTU that returns the same value.

    Please help me understand how is the expression be false for "is".

    Published by: 807216 on May 10, 2011 02:20

    For comparison, try to "ja" and "goes" final.

    final String ja = "Ja";
    final String va = "va";
    
    String java2 = "Java";
    String java1 = ja + va;
    //String java1 = "Java";
    
    System.out.println("equals: " + (java1.equals(java2)));
    System.out.println("==: " + (java1 == java2));
    

    prints

    equals: true
    ==: true
    

    This is because "ja + is going" is a constant expression and can be evaluated by the compiler.

  • Why can I not use average orders and join in an action?

    Something that I do a hundred times a day is to select two end points, their average and join them. I tried to do a deed and map it to an Fkey, but Illustrator will not allow orders average or join in an action. When I tried to use the insert a Menu command, the TI done Illustrator crash. Finally I managed to do without Illustrator crashing, but then there is no way to click 'OK' in the average dialog box through the Actions palette. Why is it seemingly impossible?

    CTRL + Shift + Alt + J

    You can certainly re - map to use a key of your choice F.

Maybe you are looking for