Author Topic: Split String To Strings and Numbers  (Read 12737 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Split String To Strings and Numbers
« Reply #30 on: March 10, 2018, 05:39:11 PM »
@Dlanor, note that the backslash is an escape character in AutoLISP, hence you will need to double-up the backslashes in your string for the backslash to appear in the RegEx pattern - working with RegEx in AutoLISP tends to suffer from Leaning Toothpick Syndrome :D

Lee

Dlanor

  • Bull Frog
  • Posts: 263
Re: Split String To Strings and Numbers
« Reply #31 on: March 10, 2018, 10:20:01 PM »
@Dlanor, note that the backslash is an escape character in AutoLISP, hence you will need to double-up the backslashes in your string for the backslash to appear in the RegEx pattern - working with RegEx in AutoLISP tends to suffer from Leaning Toothpick Syndrome :D

Hmmm..  WYSIWYG..  The shown regexp pattern produced the displayed results. If I double up the backslashes in the pattern it doesn't. Maybe it's my setup (AC2009 64 on Win 8.1) or, out on a limb, perhaps VB2010 Express.

Dlanor

  • Bull Frog
  • Posts: 263
Re: Split String To Strings and Numbers
« Reply #32 on: March 11, 2018, 07:43:15 AM »
Hmmm..  WYSIWYG..  The shown regexp pattern produced the displayed results. If I double up the backslashes in the pattern it doesn't. Maybe it's my setup (AC2009 64 on Win 8.1) or, out on a limb, perhaps VB2010 Express.

My apologies, the above doesn't hold true on my desktop (AC2012 64 on Win 7). There i need to double up the backslashes.  :wideeyed:

Wierd... I'm also now talking to myself  :idiot2: :2funny:

Ok, laptop problem, reboot and sfc throws some errors. Restoring from last good image.
« Last Edit: March 11, 2018, 08:05:33 AM by Dlanor »

Dlanor

  • Bull Frog
  • Posts: 263
Re: Split String To Strings and Numbers
« Reply #33 on: March 11, 2018, 01:02:42 PM »
This will tell you what the decimal separator is on the system

Code: [Select]
(setq d_sep (vl-registry-read "HKEY_USERS\\.DEFAULT\\Control Panel\\International" "sDecimal"))

Using the Replace Method, this regex and replacement string will return the inserted string with all instances of (digit,digit) replaced with (digit.digit)

Code: [Select]
"(\\d),(\\d)"  "$1.$2"