Sample code for 30+ languages & platforms
DataFlex

CSV - Convert Comma to Semicolon Separators

See more CSV Examples

Load a CSV using comma delimiters and convert to a CSV using semicolon delimiters.

Note: This example requires Chilkat v9.5.0.89 or greater.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoCsv
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatCsv)) To hoCsv
    If (Not(IsComObjectCreated(hoCsv))) Begin
        Send CreateComObject of hoCsv
    End

    Get ComLoadFile2 Of hoCsv "qa_data/csv/csv_wit_comma_separators.csv" "utf-8" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCsv To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Note: Prior to Chilkat v9.5.0.89, setting the Delimiter property did not modify the already-existing
    // rows in the CSV.  Updating the Delimiter property in Chilkat v9.5.0.89 or greater will cause
    // all rows to be updated with the new delimiter.
    Set ComDelimiter Of hoCsv To ";"

    Get ComSaveToString Of hoCsv To sTemp1
    Showln sTemp1


End_Procedure