~cypheon/kicad2spice

ref: 96e390bc4f914314da98ecdfd7bd775e620563e2 kicad2spice/lib/util.ml -rw-r--r-- 307 bytes
96e390bc — Johann Rudloff Implement correct pin order according to field "Spice_Node_Sequence" 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
open ExtString.String

let replace_suffix str suffix_to_remove suffix_to_add = if ends_with str suffix_to_remove
  then Some ((slice ~last:(-length suffix_to_remove) str) ^ suffix_to_add)
  else None

let replace_suffix_exn a b c err = match replace_suffix a b c with
  | Some r -> r
  | None -> raise err