Splits the string after the complete word

Hello world

I have a dynamic text that is shown completely if it has less then 280 characters. When more characters then 280 I shows the first 280 and after that I just put 3 points «...» ». Now, my question was whether it is possible to display the 3 points after the last full word after these 280 characters.

Example today: 'it's just an examp... "(the word cuts)
Example of how it should be: "it is just an example." (watch the whole word pieces around the suite)

Thanks in advance!

If this one won't, try this one:
http://www.cflib.org/UDF/abbreviate

"Shortens a string to roughly the length indicated, no stripping
tags, ensuring that the end is not cutting a word in half and adding a
character of the selection at the end."

Azadi Saryev
SABAI - Dee.com
http://www.SABAI-Dee.com/

Tags: ColdFusion

Similar Questions

  • Oracle regular expressions - splits the string into words for

    Hello

    Nice day!

    My requirement is to split the string into words.

    So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.

    Please note that I am currently embedded blank and the comma as separator, as shown below.

    Select regexp_substr('test)
    TO
    string in words, "([^, [: blanc:]] +) (', 1, 1) double;"

    How to integrate the semicolons and line break characters in regular expression Oracle?

    Please notify.

    Thanks and greetings

    Sree

    This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:

    SQL > select ' testto, mm\;
    ERROR:
    ORA-01756: city not properly finished chain

    SQL >

    Just break the chain:

    SQL > select regexp_substr ('testto, mm\;' |) '
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<= regexp_count('testto,mm\;'="" ||="">
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    Or modify SQL * more the character of endpoints:

    SQL > set sqlterm.
    SQL > select regexp_substr ('testto, mm\;)
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<=>
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    SY.

  • SQL / PLSQL to split the string into pieces

    Hi all

    I have a problem of data conversion from the name of one table to another structure.

    for example

    SQL > desc names
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    TITLE VARCHAR2 (5)
    FNAME VARCHAR2 (20)
    LNAME VARCHAR2 (20)

    SQL > Data desc
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    FULLNAME VARCHAR2 (50)


    Insert in data values ("SIR I HAVE ONE NAME PARTICULARLY LONG INDEED");
    Insert in the data values ("MINE IS EVEN MORE, ENOUGH RIDICULEMENT so IN FACT");

    Essentially, I need to divide these names long, stored in the 1 field, in the above 3 fields. The trickiest part is however I want to do it in such a way so that if the 1st part of the name fits the 1 5 char field I want to do, otherwise I would divide between 2 fields - once again without splitting a string. The reason behind this is that application will automatically put a space between each field when they appear and I would avoid gaps in the names if possible.

    This baffled me a little if any help would be seriously great... it might not even be a go-er, as it might be too uneconomic with the amount of available space, but I would give it a shot.

    Thank you!
    Adam

    Hi, Adam.

    Use regular expressions:

    INSERT INTO names (title, fname, lname)
    SELECT  RTRIM (REGEXP_SUBSTR ( fullname
                              , '^.{1,5} '
                        )
               )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20})'       ||     -- \2       = 1-20 letters
                    '(( .*)|$)'          -- \3-\4 = space (plus anything) or end
                     , '\2'
                     )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20}( |$))' ||     -- \2-\3 = 1-20 letters and space or end
                           '(.{1,20})?'       ||     -- \4       = 0-20 letters
                    '(( .*)|$)'          -- \5       = space (plus anything) or end
                     , '\4'
                     )
    FROM     data_table          -- data is not a good name
    ;
    

    Published by: Frank Kulash, August 18, 2009 11:13
    Revised to manage long single word fullname

  • Microsoft Word gets stuck when it try to split the screen

    whenever I have try to split the screen safari and Microsoft word, he always gets stuck trying to do and I always have to force quit it how can I fix?

    Not all applications are supported in split mode.

    The above comes from there:

    Use both Mac applications side by side in split view - Apple Support

  • After the reboot the magic word appeared

    After restarting my acer liquid 380 to reset the magic word appeared with what is eems Chinese language on top. I can't phone to answer for this mode and the phone stops not... What can I do to overcome this situation

    If you have a list of Chinese words, use volume down to select the last and then press the power button / stop.

  • random string after the name of the application installing app webworks

    Hello

    I have my webworks named "com.dev.improve" app, but when I run webworks run to run the project and deploy it on my phone, the terminal theres a list of info logs, which says:

    [INFO] Installing com.dev.improve.testDev_dev_improve2ba0b1c0...

    Why am I this weird string after my app name? What can I remove prossibly?

    Thank you

    This is the Package Id for your application.  You can see by opening the BAR file in a program such as WinZip and open the META-INF/TRANSLATED. MF file in a text editor.

    For unsigned files BAR, it's a dummy value to always start with test.

    Signed BAR files from the Package Id is generated based on the name of the Package you specify (com.dev.improve in your case) and your signature account.  This creates a value unique for each application and use the device to determine whether a BAR file being installed is a new application or an upgrade of an existing application.

  • splits the string into 3 parts

    Hello

    I have a requirement to split the string into 3 different room example inf.ethz.ch should be subdivided into inf ethz ch in 3 different column

    We have table called email within this column contains all identification of email we need to divide email with dot (.) in different columns and display please suggest how to implement in the query

    Thank you

    Sudhir

    Use REGEXP_SUBSTR:

    SQL > with t as (select ' inf.ethz.ch' double txt)
    2 Select regexp_substr (txt,'[^.] +') part_1,.
    3 regexp_substr (txt,'[^.] +', 1, 2) part_2,.
    4 regexp_substr (txt,'[^.] +' 1, 3) part_3
    5 t
    6.

    BY PARTY PA
    --- ---- --
    INF ethz ch

    SQL >

    Or you can use SUBSTR + Instr.

    SY.

  • Why Acrobat Pro DC hangs up after that Create begins to open the source Word file?

    Why Acrobat Pro DC hangs up after that Create begins to open the source Word file?

    I tried. He created a satisfactory smaller file. After discussion with a colleague, I suspect that the file is too big for my laptop to face. My solution is to go to a specialist agency to do the work. I'm happy to close the investigation.

    Sent from my iPad

  • Choose the Second word of the string

    How to get the second word in a string. Each word is separated from the space. If there is only a single word, to return the first word

    For example:

    "abc of anus ijk" I need to go back to

    If the string is

    'abc', I need to return to abc

    Thanks in advance

    Hello

    Try this:

    Select NVL (regexp_substr (your_string, "[^ [: space:]] +' 1, 2"), your_string) double

  • Hello! I ve a problem with the complete abo... How can I activate illustrator after regulation time? the complete abo is already saved for the last month...

    Hello! I ve a problem with the complete abo... How can I activate illustrator after regulation time? the complete abo is already saved for the last month...

    [Duplicate message deleted... post the same question more than once is confusing... MOD]

    [This is an open forum, not a direct line to Adobe support... you have to wait a response]

    Hello

    Please see: -.

    https://helpx.Adobe.com/manage-account-membership/CC-reverts-to-trial.html

  • What specific products are part of the complete abo for cs5-client, which will be the price after one year and will be the rice price information early enough to cancel the contract? Best regards Jürgen

    What specific products are part of the complete abo for cs5-client, which will be the price after one year and will be the rice price information early enough to cancel the contract? Best regards Jürgen

    For details please see the link below:

    Pricing plans and creative Cloud membership | Adobe Creative Cloud

    Otherwise, you can reach the Adobe sales as well.

  • Retrieve the string after the symbol @.

    Hello

    I need a suggestion how to extract the string after the symbol ' @' in the string.

    The user will pass the Email that I need to extract the domain name of the string

    > > Eg: [email protected]

    She must return to gmail.com under the domain name, please suggest me


    Thank you
    Sudhir

    Try:

    select substr('[email protected]', instr('[email protected]', '@')+1) from dual
    
  • Concatenate and split the string

    Hi all

    Is there some how we can split the string like this "1 | ~ | Diego | Maradona | ~ | Footballer | The Argentina.

    in the table of 3 elements: '1', ' Diego | Maradona', ' football '. The Argentina.

    Here is my code
    public static void main(String args[]){
              System.out.println("========USE SPLIT========== " );
                   String data = "1 |~| Diego|Maradona |~| Footballer|Argentina";
                 String[] items = data.split(" |~| ");
                 for (String item : items)
                 {
                      System.out.println("item = " + item);
                 }
                 StringTokenizer tok = new StringTokenizer(data," |~| ");
                 System.out.println("========USE TOKENIZER========== " );
                 while(tok.hasMoreElements()){
                      System.out.println("item = " + tok.nextToken());
                 }
              
         }
    and put it is:
    = USE SPLIT =.
    Item = 1
    Item = |
    Item = |
    Item = Diego | Maradona
    Item = |
    Item = |
    Item = football | Argentina
    = USE TOKENIZE =.
    Item = 1
    Item = Diego
    Item = Maradona
    Item = footballer
    Item = Argentina

    Published by: mycoffee on February 1, 2011 06:49

    Split() takes a regular expression. ' | ' has a special meaning in regular expressions.

    Try to use

    " \\|~\\| "
    

    as the argument of split()

  • String after ' &lt; ' character is not in the reports of the Apex

    Hello

    I've created a report where a column has ' < ' and ' > ' symbol included in this one.
    example of
    1. abc < def girou
    2 abc < def girou
    3 abc > def girou

    If assumes that the data for the column "xyz" in table 1 has 3 data into it above.

    In a report, I show this column with a simple select statement "xyz select from table1.
    the output like this

    1. abc
    2 abc < def girou
    3 abc > def girou


    The report ignores the string after ' < ' and works fine if I have space.

    Can someone help me with this please

    Published by: user12589255 on July 27, 2010 14:39

    Published by: user12589255 on July 27, 2010 15:21

    Hi user12589255,

    I think he just change report column display in the "Standard report column" type to "escaped...". "to overcome this problem.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins

  • splits the string into documents

    Hello

    I did a query (see regexp) that split a string into records. The problem with the query is the separate in the subquery. Otherwise, it returns millions of records where I expect less than a thousand.
    Meanwhile, I found an other solution (see xmlsequence), but this statement returns the message "ORA-03113: end of file on the communication channel.

    Please advice.

    regexp:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT distinct box_code, regexp_substr(box_pos,'[^,]+',1,level) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             )
             connect by level <= length(box_pos) - length(replace(box_pos,',')) + 1
        ) box
        WHERE smp.u_box_code = box.box_code
        AND smp.u_box_position = box.box_pos
    xmlsequence:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT  box_code, trim(x.column_value.extract('e/text()')) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             ) t, table (xmlsequence(xmltype('<e><e>' || replace(t.box_pos,',','</e><e>')|| '</e></e>').extract('e/e'))) x
        ) box
        WHERE smp.u_box_code = box.box_code

    Hello

    When 'LEVEL '.<= x"="" is="" the="" only="" connect="" by="" condition,="" then="" you="" should="" be="" using="" a="" table="" that="" has="" only="" one="" row,="" like="">

    You can generate a Table of counters (a result set, in fact) who has all the integers that you need and then join one.
    The next thread is an example:
    I don't don't want to mark in plsql

Maybe you are looking for