feat: add custom delimiter input and update subtitle text

Delimiter dropdown now includes "Other" option with a text input for
custom delimiter characters. Subtitle updated to mention delimited text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 00:46:12 +00:00
parent 310bea08bf
commit ec9f100e67

View File

@@ -68,7 +68,7 @@ for key, default in _DEFAULTS.items():
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
st.title("DataTools Deduplicator") st.title("DataTools Deduplicator")
st.caption("Find and remove duplicate rows in CSV and Excel files.") st.caption("Find and remove duplicate rows in CSV, delimited text, and Excel files.")
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -151,6 +151,7 @@ if uploaded is not None:
"Tab (\\t)": "\t", "Tab (\\t)": "\t",
"Semicolon (;)": ";", "Semicolon (;)": ";",
"Pipe (|)": "|", "Pipe (|)": "|",
"Other": None,
} }
_DELIM_LABELS = list(_DELIMITERS.keys()) _DELIM_LABELS = list(_DELIMITERS.keys())
_DELIM_VALUES = list(_DELIMITERS.values()) _DELIM_VALUES = list(_DELIMITERS.values())
@@ -162,6 +163,14 @@ if uploaded is not None:
index=default_idx, index=default_idx,
help="Auto-detected on upload. Change if the preview looks wrong.", help="Auto-detected on upload. Change if the preview looks wrong.",
) )
if chosen_label == "Other":
custom_delim = st.text_input(
"Enter delimiter character",
max_chars=5,
help="Enter the character(s) used to separate fields.",
)
chosen_delim = custom_delim if custom_delim else ","
else:
chosen_delim = _DELIMITERS[chosen_label] chosen_delim = _DELIMITERS[chosen_label]
if chosen_delim != st.session_state.get("_current_delimiter"): if chosen_delim != st.session_state.get("_current_delimiter"):
st.session_state["_current_delimiter"] = chosen_delim st.session_state["_current_delimiter"] = chosen_delim