Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Composition Setup
import.css=/download/attachments/6062824/tecnologia.css
Portuguese

Pagetitle
NotBit
NotBit

Inverte os bits dos caracteres de uma string.

Sintaxe

cpp
Bloco de código
language
collapsefalse
NotBit( < @cStr >, < nLength > )

Parâmetros

Nome

Tipo

Descrição

Obrigatório

Referência

cStr

caractere

Indica a string que será modificada.

X

X

nLength

numérico

Indica a quantidade de caracteres que terão seus bits invertidos.

X

 

Observações

  • nLength inicia em 1.
  • Caso o tamanho da string passada em cStr seja menor do que o valor passado em nLength, a aplicação AdvPL é interrompida com a exceção "Bit string out of bounds on NotBit".

Exemplos

Bloco de código
themeEclipse
languagecpp
titleExemplo 1
linenumberstrue
collapsefalse
User Function tstNotBit()
  Local cStr := "", cRet := ""
  Local nLen := 0
  
  cStr := chr( 255 ) + chr( 255 ) + chr( 255 ) + chr( 255 )
  nLen := Len( cStr )
  NotBit( @cStr, nLen )
  
  //será exibida a string "00000000000000000000000000000000"
  conout( bitstrdump( cStr ) )
return

STATIC Function BitStrDump( cString, nStart, nLength )
  Local cStrDump := '', cAsc := ''
  Local nTamStr := len( cString ), nI := 0
  DEFAULT nStart  := 1
  DEFAULT nLength := nTamStr
  
  cString := SubStr( cString, nStart, nLength )
  For nI := 1 to nTamStr
    cASC := SubStr( cString, nI, 1 )
    cStrDump += NToC( Asc( cASC ), 2, 8, "0" )
  Next nI
Return cStrDump

Veja também

...