mirror of
https://github.com/vlang/v.git
synced 2025-09-09 07:15:50 -04:00
string: optimize is_ascii()
This commit is contained in:
parent
70b33fc303
commit
549e11bfa1
11
thirdparty/sokol/sokol_app.h
vendored
11
thirdparty/sokol/sokol_app.h
vendored
@ -3907,6 +3907,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
|
||||
@implementation _sapp_macos_app_delegate
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
||||
_SOKOL_UNUSED(aNotification);
|
||||
|
||||
_sapp_macos_init_cursors();
|
||||
if ((_sapp.window_width == 0) || (_sapp.window_height == 0)) {
|
||||
// use 4/5 of screen size as default size
|
||||
@ -4104,7 +4105,17 @@ keyEquivalent:@"v"];
|
||||
_sapp_macos_update_dimensions();
|
||||
[NSEvent setMouseCoalescingEnabled:NO];
|
||||
|
||||
|
||||
// __v_ start
|
||||
/*
|
||||
NSApplicationPresentationOptions options = (NSApplicationPresentationAutoHideMenuBar |
|
||||
NSApplicationPresentationAutoHideDock |
|
||||
NSApplicationPresentationFullScreen |
|
||||
NSApplicationPresentationHideDock);
|
||||
|
||||
[NSApp setPresentationOptions:options];
|
||||
*/
|
||||
|
||||
//[NSEvent setMouseCoalescingEnabled:NO];
|
||||
// __v_ end
|
||||
}
|
||||
|
@ -2604,7 +2604,12 @@ pub fn (name string) match_glob(pattern string) bool {
|
||||
// is_ascii returns true if all characters belong to the US-ASCII set ([` `..`~`])
|
||||
@[inline]
|
||||
pub fn (s string) is_ascii() bool {
|
||||
return !s.bytes().any(it < u8(` `) || it > u8(`~`))
|
||||
for i := 0; i < s.len; i++ {
|
||||
if s[i] < u8(` `) || s[i] > u8(`~`) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// camel_to_snake convert string from camelCase to snake_case
|
||||
|
Loading…
x
Reference in New Issue
Block a user