Re: help extracting number from string
Joe-Tob Thank you for the advice Joe Thank you very much indeed for your solutions. They help a lot! Best Regards Dean On 16 December 2016 at 00:59, Joe Bogner wrote: > This is probably better: > > : (extract format (split (mapcar format (chop "35fabc79")) NIL)) > -> (35 79) > > > > On Thu, Dec 15, 2016 at 7:57 PM, Joe Bogner wrote: > >> OK, how about this this? >> >> : (mapcar format (extract pack (split (mapcar format (chop "35fabc79")) >> NIL))) >> -> (35 79) >> >> : (mapcar format (extract pack (split (mapcar format (chop "35f79")) >> NIL))) >> -> (35 79) >> >> On Thu, Dec 15, 2016 at 7:36 PM, Joh-Tob Schäg >> wrote: >> >>> If i understood it correctly he wants to get all groups of number. >>> "35f79" -> (35 79) >>> Am 16.12.2016 09:28 schrieb "Joe Bogner" : >>> how about : (extract format (chop 'ab33Cd)) -> (3 3) or : (format (pack (extract format (chop 'ab33Cd -> 33 On Thu, Dec 15, 2016 at 4:16 PM, dean wrote: > I've seen num? and chop but think I need something in the middle to > turn a character to a number > > Having said that I seem to have got close by accident...i.e. I was > going to try and bend this...but it found a single integer as it was :) > > : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) > -> "3" > > I'd like this to detect 33 but see that chop precludes this. > > Any help much appreciated. > > >> >
Re: help extracting number from string
This is probably better: : (extract format (split (mapcar format (chop "35fabc79")) NIL)) -> (35 79) On Thu, Dec 15, 2016 at 7:57 PM, Joe Bogner wrote: > OK, how about this this? > > : (mapcar format (extract pack (split (mapcar format (chop "35fabc79")) > NIL))) > -> (35 79) > > : (mapcar format (extract pack (split (mapcar format (chop "35f79")) NIL))) > -> (35 79) > > On Thu, Dec 15, 2016 at 7:36 PM, Joh-Tob Schäg > wrote: > >> If i understood it correctly he wants to get all groups of number. >> "35f79" -> (35 79) >> Am 16.12.2016 09:28 schrieb "Joe Bogner" : >> >>> how about >>> >>> : (extract format (chop 'ab33Cd)) >>> -> (3 3) >>> >>> or >>> >>> : (format (pack (extract format (chop 'ab33Cd >>> -> 33 >>> >>> >>> On Thu, Dec 15, 2016 at 4:16 PM, dean wrote: >>> I've seen num? and chop but think I need something in the middle to turn a character to a number Having said that I seem to have got close by accident...i.e. I was going to try and bend this...but it found a single integer as it was :) : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) -> "3" I'd like this to detect 33 but see that chop precludes this. Any help much appreciated. >>> >
Re: help extracting number from string
OK, how about this this? : (mapcar format (extract pack (split (mapcar format (chop "35fabc79")) NIL))) -> (35 79) : (mapcar format (extract pack (split (mapcar format (chop "35f79")) NIL))) -> (35 79) On Thu, Dec 15, 2016 at 7:36 PM, Joh-Tob Schäg wrote: > If i understood it correctly he wants to get all groups of number. "35f79" > -> (35 79) > Am 16.12.2016 09:28 schrieb "Joe Bogner" : > >> how about >> >> : (extract format (chop 'ab33Cd)) >> -> (3 3) >> >> or >> >> : (format (pack (extract format (chop 'ab33Cd >> -> 33 >> >> >> On Thu, Dec 15, 2016 at 4:16 PM, dean wrote: >> >>> I've seen num? and chop but think I need something in the middle to turn >>> a character to a number >>> >>> Having said that I seem to have got close by accident...i.e. I was going >>> to try and bend this...but it found a single integer as it was :) >>> >>> : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) >>> -> "3" >>> >>> I'd like this to detect 33 but see that chop precludes this. >>> >>> Any help much appreciated. >>> >>> >>
Re: help extracting number from string
If i understood it correctly he wants to get all groups of number. "35f79" -> (35 79) Am 16.12.2016 09:28 schrieb "Joe Bogner" : > how about > > : (extract format (chop 'ab33Cd)) > -> (3 3) > > or > > : (format (pack (extract format (chop 'ab33Cd > -> 33 > > > On Thu, Dec 15, 2016 at 4:16 PM, dean wrote: > >> I've seen num? and chop but think I need something in the middle to turn >> a character to a number >> >> Having said that I seem to have got close by accident...i.e. I was going >> to try and bend this...but it found a single integer as it was :) >> >> : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) >> -> "3" >> >> I'd like this to detect 33 but see that chop precludes this. >> >> Any help much appreciated. >> >> >
Re: help extracting number from string
how about : (extract format (chop 'ab33Cd)) -> (3 3) or : (format (pack (extract format (chop 'ab33Cd -> 33 On Thu, Dec 15, 2016 at 4:16 PM, dean wrote: > I've seen num? and chop but think I need something in the middle to turn a > character to a number. > > Having said that I seem to have got close by accident...i.e. I was going > to try and bend this...but it found a single integer as it was :) > > : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) > -> "3" > > I'd like this to detect 33 but see that chop precludes this. > > Any help much appreciated. > >
Re: help extracting number from string
I am just telling you pick can not help you here. In this case just write a coroutine. You can handle different reading modes (numbers vs strings) in there easily. Am 16.12.2016 06:24 schrieb "dean" : > I've seen num? and chop but think I need something in the middle to turn a > character to a number. > > Having said that I seem to have got close by accident...i.e. I was going > to try and bend this...but it found a single integer as it was :) > > : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) (chop 'ab33Cd)) > -> "3" > > I'd like this to detect 33 but see that chop precludes this. > > Any help much appreciated. > >