Zum Hauptinhalt gehen

Suche

Suche

Extracting Part Of String From Database Field Based On Certain Character

Kommentare

2 Kommentare

  • Avatar
    Legacy Poster

    Maybe try something like this (assumes that there will only ever be one occurrence of # followed by a space in the field's content):

     

    str = Format.NamedSubStrings("NameOfDataSourceContainingTheDBFieldContent").Value
    splitat = "# "
    
    str_segments = Split(str, splitat)
    
    Value = str_segments(1)
    
    0
  • Avatar
    Legacy Poster
    used the OnProcessData option.
     
    pos = 0
    pos = Instr(Value, "#") +1
    
    if pos > 1 then
     value = Trim(Mid(value,pos))
    elseif pos = 1 then
     value = ""
    End If
    
    works just fine
     
    Example:
     
    'this part we don't need # just this part'
     
    will translate to:
     
    'just this part'

     
    Note: when no # is in the line we will print nothing.
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.