コード例 #1
0
ファイル: levenshtein.c プロジェクト: Saursinet/42sh
char	*levenshtein(char *str, UNUSED char **env)
{
  char	**dic;
  char	**command;
  int	i;
  int	pos;

  i = 0;
  pos = 0;
  command = cut_command(str);
  if ((dic = gen_data(save_my_env(NULL))) == NULL)
    return (str);
  while (command && command[i] != NULL)
    {
      if (i == 0 || is_separator_ext(command[i - 1][0]) == 0)
	{
	  if (check_command(command[i], save_my_env(NULL)) == -1)
	    {
	      pos = where_is_space(command[i]);
	      command[i] = change_command(command[i],
					  leven(dic, po_s(command[i], pos)));
	    }
	}
      i++;
    }
  free_array_char(dic);
  return (tab_string(command));
}
コード例 #2
0
	tstring XMLFileSerializer::GetTabString(uint32 & tabs)
	{
		tstring tab_string(EMPTY_STRING);
		for(uint32 i = 0 ; i < tabs ; ++i)
		{
			tab_string += TAB;
		}
		return tab_string;
	}