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.is_pure_ascii() #22748

Merged
merged 2 commits into from
Nov 3, 2024
Merged

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Nov 3, 2024

This PR add string.is_pure_ascii() and modify all the related calls.

fn test_len_utf8() {
	assert 'Vlang'.len_utf8() == 5
	assert 'María'.len_utf8() == 5
	assert '姓名'.len_utf8() == 2
	assert 'Слово'.len_utf8() == 5
	assert 'Λέξη'.len_utf8() == 4
}

fn test_is_pure_ascii() {
	assert 'Vlang'.is_pure_ascii()
	assert !'María'.is_pure_ascii()
	assert !'姓名'.is_pure_ascii()
	assert !'Слово'.is_pure_ascii()
	assert !'Λέξη'.is_pure_ascii()
}

Huly®: V_0.6-21194

Copy link
Member

@Delta456 Delta456 left a comment

Choose a reason for hiding this comment

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

Can you add tests for this?

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 ea19923 into vlang:master Nov 3, 2024
78 checks passed
@yuyi98 yuyi98 deleted the add_is_pure_ascii branch November 4, 2024 01:00
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.

3 participants