Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6c73a4ee50cd84e026061b520f59c5807c79cef4
Ticket: 688554ffffffffffffffffffffffffffffffffff
string match doesn't match strings with NULLs
User & Date: nobody on 2003-02-18 09:49:10
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    [email protected]
    
    The following string doesn't work correctly. Depending
    on the 'binary' line commented out or not 'string
    match' gives different results. This is true for
    tcl8.4.0 and tcl8.4.1.
    
    
    proc MatchElem {constraint queueElem} {
      set result 0
    # binary scan $queueElem H* bele1
      set result [string match $constraint $queueElem]
      puts "Match '$constraint' with '$queueElem': result
    $result"
      binary scan $queueElem H* bele2
      puts "Match '$constraint' with '$queueElem' ($bele2):
    result $result"
      return $result
    }
    
    set con "*abc*"
    
    set a "\000@abc"
    MatchElem $con $a
    puts "[string match $con $a]"
    
    set a "@abc"
    MatchElem $con $a
    #puts "[string match $con $a]"
    
    set a "\000@abc\000"
    MatchElem $con $a
    #puts "[string match $con $a]"
    
  4. foundin changed to: "obsolete: 8.4.1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "18. Commands M-Z"
  10. title changed to: "string match doesn't match strings with NULLs"
  11. type changed to: "Bug"