Hi!
Lets say I have a string:
jghweiauhoigafawgeu
But I want a space at every three letters like this:
jgh wei auh oig afa wge u
Any simple solution? My other option is a for loop but I'm curious to see a simpler way.
-Olivier
VEX String: add space after each 3 letters?
758 6 1- olivierth
- Member
- 1074 posts
- Joined: April 2017
- Offline
- alexwheezy
- Member
- 297 posts
- Joined: Jan. 2013
- Offline
- animatrix_
- Member
- 4685 posts
- Joined: Feb. 2012
- Offline
Hi,
You can do this using regex easily:
You can do this using regex easily:
string input = "jghweiauhoigafawgeu"; string result = join ( re_findall (".{1,3}", input ), " " );
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
- olivierth
- Member
- 1074 posts
- Joined: April 2017
- Offline
- ajz3d
- Member
- 570 posts
- Joined: Aug. 2014
- Offline
[a-z]{1,3}
jGhw eia-uhoigafawgeufs
---
0-1 j
2-4 hw
5-8 eia
9-12 uho
12-15 iga
15-18 faw
18-21 geu
21-23 fs
.{1,3}
.
). Note that it will match whitespace.jGhw eia-uhoigafawgeufs
---
0-3 jGh
3-6 w e
6-9 ia-
9-12 uho
12-15 iga
15-18 faw
18-21 geu
21-23 fs
- olivierth
- Member
- 1074 posts
- Joined: April 2017
- Offline
-
- Quick Links