MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » December 2013

Re: SQL Reverse Function



fixed

On 19-Dec-2013 19:38 -0800, Gad Miron wrote:
I neglected to mention that there might be numbers embedded in the
string, The numbers needs to remain intact.
Given a 'ab123cd' string, a simple reverse will get me
cd321ba instead of dc123ba
Once upon a time I wrote a RPG programs that reverses entire string
and then reversing all numeric substring within the (reversed) result
string, I guess I should start dusting old libraries...


The following text which was quoted in the above reply which has "Subject: Re: MIDRANGE-L Digest, Vol 12, Issue 2394" remains quoted below in order to emphasize\remind of the instructions that were apparently overlooked:


When replying, *please edit your Subject line* so it is more
specific than "Re: Contents of MIDRANGE-L digest..."

*** NOTE: When replying to this digest message,
*PLEASEremove all text unrelated to your reply* and
*change the subject line* so it is meaningful.


Are there any specific constraints on the character string data? Are the input strings always trimmed [left and right], and if not, should the reversed characters reflect the trimmed or untrimmed input string? Will all characters always be only digits or simple a-z and A-Z alphabetic perhaps? Will the /numbers/ reflect only positive and otherwise unedited values; no sign, decimal separator, thousands, etc.?

Many more examples would be valuable to more fully imply the requirements. For example, of the following values, what should be the effect for the /reversal/, or should the value never exist [according to constraints on the data; enforced or merely presumed, no matter] such that the result is *undefined; e.g. something like:

_input-string_ _reverse(input-string) result_
'7o65danr43ot2' '7t65orna43do2
'765nrot' '765torn'
'nrot765' 'torn765'
'123456789' '123456789'
'12e4567a9' '12a4567e9'
't77 ' ' 77 t' or 't77' or *undefined
' y42 ' ' 42 y ' or 'y 42' or 'y42' or *undefined
'DDLXMP2_ ' ' _PMX2LDD' or '_PMXLD2D'
'SLA1AA ' ' 1 AAALS' or 'AAA1LS' or *undefined







Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact