Search notes:

vim script: str2nr

str2nr converts a string with a number in a binary, octal, decimal or hexadecimal representation to a numeric.
" ../run_ str2nr

redir > str2nr.out

" 11001 binary is: 25
echo str2nr('11001', 2)

" 111 octal is: 73 = 8*8 + 8 + 1
echo str2nr('111', 8)

" ff hexadecimal is: 255
echo str2nr('ff', 16)

" Using base 16 ignores leading 0x,
" the following prints 127
echo str2nr('0x7f', 16)

redir END
q
Github repository about-vim, path: /vimscript/functions/str2nr.vim

See also

char2nr(), nr2char()
Vim: built in functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1737519823, '18.191.195.2', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/vim/script/vimscript/functions/str2nr(62): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78