• How to divide a text string into two parts?

    Hello, I need help to solve this:

    I first have to divide a text string into two parts

    The post title field contains this “31/10/2020 Classes Start”

    In the first part, I need to extract the date and then get the month in M ??date format, so that “OCT” is displayed

    The first thing I did was:

    [field title words = 1]

    With this I get “31/10/2020”

    Now I need to extract the month “10” in M ??format to get the word OCT. How do I do that?

    As a second part I just need the rest of the text to show it separately. How do I extract text from a position?

    I hope you can help me.

    Thanks for your time.

    George.

    • This topic was modified 4 years, 8 months ago by jvasquez.
    • This topic was modified 4 years, 8 months ago by jvasquez.
    • This topic was modified 4 years, 8 months ago by jvasquez.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use
    [format split="-" part=2]WHAT_YOU_NEED-TO-SPLIT[/format]

    returns in this case TO as it is the second part that is separated with a -

    or in your case:

    content of [field yourfield] is “31/10/2020 Classes Start”

    [format split="/" part=2][field yourfield][/format]

    will return you the 10 you like to get.

    But you can also use format further and split of the complete date and the format the month with [fomat date=M].

    So I would try something like:

    [format date=M][format split=" " part=1][field yourfield][/format][/format]

    • This reply was modified 4 years, 8 months ago by polarracing.
    • This reply was modified 4 years, 8 months ago by polarracing.
    Thread Starter jvasquez

    (@jvasquez)

    Thank you very much for your help, the second syntax does not work,

    I hope someone can continue helping me.

    Thank you

    You could also try:

    [set myvar][format split="/" part=2][field yourfield][/format][/set]

    Then you should have as result the 10 for the month. (In your example)

    After that you can use while to define the final output of your variable and use it where you like with [get myvar].

    • This reply was modified 4 years, 8 months ago by polarracing.
    • This reply was modified 4 years, 8 months ago by polarracing.
    • This reply was modified 4 years, 8 months ago by polarracing.
    • This reply was modified 4 years, 8 months ago by polarracing.
    Thread Starter jvasquez

    (@jvasquez)

    thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘extract a date from the title field’ is closed to new replies.