Created
September 23, 2014 16:33
-
-
Save slmcmahon/594da214a0fc58523204 to your computer and use it in GitHub Desktop.
Reports the index of any characters in a string where the ASCII value is greater than 127
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
@test nvarchar(500), | |
@idx int, | |
@c nchar(1) | |
set @idx = 1 | |
set @test = 'Nå er tiden for alle gode menn til å komme til unnsetning for landet sitt.' | |
while @idx < LEN(@test) | |
begin | |
set @c = SUBSTRING(@test, @idx, 1) | |
if (ASCII(@c) > 127) | |
print @c + ': ' + cast(ASCII(@c) as nvarchar(5)) + ' at ' + cast(@idx as varchar(5)) | |
set @idx = @idx + 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment