~ubuntu-branches/ubuntu/feisty/renameutils/feisty

« back to all changes in this revision

Viewing changes to src/common/string-utils.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2004-04-29 13:41:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040429134134-vwe8r35v0mmk3s9m
Tags: 0.4.0-2
* Fixed a typo in the qmv manpage (Closes: #245196)
* Changed short and long description
* Fixed build error on 64-bit machines (Closes: #246179)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* string-utils.c - Functions dealing with string contents.
 
2
 *
 
3
 * Copyright (C) 2001  Oskar Liljeblad
 
4
 *
 
5
 * This file is part of the file renaming utilities (renameutils)
 
6
 * and regex-markup.
 
7
 *
 
8
 * This software is copyrighted work licensed under the terms of the
 
9
 * GNU General Public License. Please consult the file `COPYING' for
 
10
 * details.
 
11
 */
 
12
 
 
13
#ifndef __STRING_UTILS_H__
 
14
#define __STRING_UTILS_H__
 
15
 
 
16
#include <sys/types.h>
 
17
#include <ctype.h>              /* for toupper and tolower */
 
18
#include "compat.h"
 
19
#include "common.h"
 
20
 
 
21
int strindex(const char *str, char ch);
 
22
void chomp(char *str);
 
23
void strip_leading(char *line, int (*check)(int));
 
24
int char_index(const char *line, int (*check)(int));
 
25
bool ends_with(const char *str, const char *end);
 
26
bool starts_with(const char *str, const char *start);
 
27
int translate_char(char *str, char from, char to);
 
28
void str_convert(char *str, int (*convert)(int));
 
29
#define str_toupper(str)        str_convert((str), toupper)
 
30
#define str_tolower(str)        str_convert((str), tolower)
 
31
int iswordchar(int ch);
 
32
bool replace_str(char *str, const char *from, const char *to);
 
33
char *cat_files(const char *file, const char *file2);
 
34
char *substring(const char *buf, int start, int end);
 
35
 
 
36
int string_strip_trailing(char *str, const char *stripchars);
 
37
int string_strip_trailing_c(char *str, char stripchar);
 
38
/* int string_strip_trailing_f(char *str, int (*function)(int)); */
 
39
int string_strip_leading(char *str, const char *stripchars);
 
40
int string_strip_leading_c(char *str, char stripchar);
 
41
/* int string_strip_leading_f(char *str, int (*function)(int)); */
 
42
 
 
43
#define string_index_of_c       strindex
 
44
/* int string_index_of(const char *str, const char *findstr);
 
45
int string_index_of_char(const char *str, char findchar);
 
46
int string_index_of_any_f(const char *str, int (*function)(int)); */
 
47
int string_index_of_any(const char *str, const char *findchars);
 
48
 
 
49
int word_get_index(const char *str, int pos);
 
50
char *word_get(const char *str, int idx);
 
51
 
 
52
int uintlen(uint64_t value);
 
53
char *xdirname(const char *path);
 
54
 
 
55
bool ends_with_nocase(const char *str, const char *end);
 
56
bool starts_with_nocase(const char *str, const char *start);
 
57
 
 
58
#endif