on 06-22-2015 3:37 PM
Team,
I want to apply word wrapping logic where expected Input data and Expected output data is as below.
My source data can or can't have more than 60 characters, carriage return. I want my output without carriage return
and in 60 charactre fixed width multiple line format.
Input
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<CR>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<CR>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.<CR>
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Output
1 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
3 aliqua.
4 Ut enim ad minim veniam, quis nostrud exercitation ullamco
5 laboris nisi ut aliquip ex ea commodo consequat.
6 Duis aute irure dolor in reprehenderit in voluptate velit
7 esse cillum dolore eu fugiat nulla pariatur.
8 Excepteur sint occaecat cupidatat non proident, sunt in
9 culpa qui officia deserunt mollit anim id est laborum.
Can someone send me custom function code ?
I want to use it for different lengths, like in above case its 60.
And I need to avoid word braking also while moving to next line..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for inspiring comment..!
I written my own code and tested successfully.
If you look carefully my requirements are fferent.
Anyway,
Now just one issue in my function,
My script has one line where I am using an input parameter(integer) as second parameter to RPAD function. But I get some error like "Second parameter of RPAD must be an integer"
I need to use my function for different length in different jobs so I must keep it parameter..
Any guess ?
Hi Roshan,
Try some customfunction like this:
Initial : $Counter = 1;
CustomFun('Input')
While($Counter = 60 or $line = '<CR>')
{
$String = $String||Substr('Input',$Counter,1);
$line = Substr('Input',[$Counter]+1,4);
$Counter = $Counter + 1;
}
Return($String)
Thanks,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you use word_ext() using your <CR> as the delimiter... You can loop through your input lines, then loop through the words within each input line, and conditionally concatenate each word to a single output line, separated by a unique delimiter (on break).
fun stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.