Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin: add string.split_by_space() #23651

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

gechandesu
Copy link
Contributor

@gechandesu gechandesu commented Feb 4, 2025

This PR:

  • Add new fn split_by_space() for string builtin.
  • Add test

Usecase:

>>> cmd := os.execute('ip -br link show wlan0')
>>> cmd.output
wlan0            UP             14:75:7b:ca:a2:c4 <BROADCAST,MULTICAST,UP,LOWER_UP> 
>>> cmd.output.split_by_space()
['wlan0', 'UP', '14:75:7b:ca:a2:c4', '<BROADCAST,MULTICAST,UP,LOWER_UP>']
>>> mac := cmd.output.split_by_space()[2]
>>> mac
14:75:7b:ca:a2:c4

Copy link

Connected to Huly®: V_0.6-22072

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit 4f85b35 into vlang:master Feb 4, 2025
71 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants