builtin: make string.(left|right) pub (#8245)
							parent
							
								
									d44c632d11
								
							
						
					
					
						commit
						820e684313
					
				| 
						 | 
					@ -591,7 +591,7 @@ pub fn (s string) split_into_lines() []string {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// left returns the `n`th leftmost characters of the string.
 | 
					// left returns the `n`th leftmost characters of the string.
 | 
				
			||||||
// Example: assert 'hello'.left(2) == 'he'
 | 
					// Example: assert 'hello'.left(2) == 'he'
 | 
				
			||||||
fn (s string) left(n int) string {
 | 
					pub fn (s string) left(n int) string {
 | 
				
			||||||
	if n >= s.len {
 | 
						if n >= s.len {
 | 
				
			||||||
		return s
 | 
							return s
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -600,7 +600,7 @@ fn (s string) left(n int) string {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// right returns the `n`th rightmost characters of the string.
 | 
					// right returns the `n`th rightmost characters of the string.
 | 
				
			||||||
// Example: assert 'hello'.right(2) == 'lo'
 | 
					// Example: assert 'hello'.right(2) == 'lo'
 | 
				
			||||||
fn (s string) right(n int) string {
 | 
					pub fn (s string) right(n int) string {
 | 
				
			||||||
	if n >= s.len {
 | 
						if n >= s.len {
 | 
				
			||||||
		return ''
 | 
							return ''
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue