Exemple #1
0
int main()
{
    //find
    printf("Found1 at %i\n", findString("chatterbox", "hat"));
    printf("Found2 at %i\n", findString("chatterbox", "att"));
    printf("Found3 at %i\n", findString("chatterbox", "box"));
    printf("Found4 at %i\n", findString("chatterbox", "boxx"));
    
    //remove
    char str3[20] = "chatterbox";
    removeString(str3, 9, 1);
    printf("\nAfter remove1 = %s\n", str3);
    
    char str4[20] = "chatterbox";
    removeString(str4, 9, 2);
    printf("After remove2 = %s\n", str4);
    
    char str5[20] = "chatterbox";
    removeString(str5, 0, 9);
    printf("After remove3 = %s\n", str5);
    
    //insert
    char str8[20] = "the wrong son";
    
    insertString(str8, "per", 14 );
    printf("\nAfter insert1  = %s\n", str8);
    
    insertString(str8, "per", 10 );
    printf("After insert2  = %s\n", str8);
    
    insertString(str8, "You are ", 0);
    printf("After insert3  = %s\n\n", str8);    
    return 0;
}
bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList,
                                           String& nameOfPluginBeingScanned)
{
    const int index = --nextIndex;

    if (index >= 0)
    {
        auto file = filesOrIdentifiersToScan [index];

        if (file.isNotEmpty() && ! (dontRescanIfAlreadyInList && list.isListingUpToDate (file, format)))
        {
            nameOfPluginBeingScanned = format.getNameOfPluginFromIdentifier (file);

            OwnedArray<PluginDescription> typesFound;

            // Add this plugin to the end of the dead-man's pedal list in case it crashes...
            auto crashedPlugins = readDeadMansPedalFile (deadMansPedalFile);
            crashedPlugins.removeString (file);
            crashedPlugins.add (file);
            setDeadMansPedalFile (crashedPlugins);

            list.scanAndAddFile (file, dontRescanIfAlreadyInList, typesFound, format);

            // Managed to load without crashing, so remove it from the dead-man's-pedal..
            crashedPlugins.removeString (file);
            setDeadMansPedalFile (crashedPlugins);

            if (typesFound.size() == 0 && ! list.getBlacklistedFiles().contains (file))
                failedFiles.add (file);
        }
    }

    updateProgress();
    return index > 0;
}
int main (void) 
{
	char removeString (char text[], int start, int length);
	char text[] = "the wrong song";
    printf("%c\n", removeString(text, 4, 6));
    return 0;
}
int main(void){
    int i;
    char text [] = "the wrong son";
    removeString(text, 4, 6);
    
    for ( i = 0; i < 13; ++i)
        printf("%c", text[i]);
    
}
Exemple #5
0
int main (void)
{
    char text[] = "the wrong son";

    removeString(text, 4, 6);
    printf("%s", text);

    return 0;
}
Exemple #6
0
int main() {
	
	LinkedList* ll = llCreate();

	char* str = "hello";
	char* str2 = "ping";
	char* str3 = "pong";
	char* str4 = "pinga";
	char* str5 = "da";
	char* str6 = "ponga";
	char* str7 = "yup";

	llAdd(&ll, str);
	llAdd(&ll, str);
	llAdd(&ll, str);
	llAdd(&ll, str4);
	llAdd(&ll, str);
	llAdd(&ll, str6);	

	printf("LinkedList after adding a bunch of strings:\n");
	llDisplay(ll);
	printf("Size:  %d\n\n", size(ll));


	int index = 4;
	printf("LinkedList after adding '%d' at index %d:\n", str7, index);
	addAtIndex(&ll, str7, index);
	llDisplay(ll);
	printf("Size:  %d\n\n", size(ll));

	
	index = 3;
	printf("LinkedList after removing the word at index %d:\n", index);
	removeAtIndex(&ll, index);
	llDisplay(ll);
	printf("Size:  %d\n\n", size(ll));

	printf("LinkedList after removing all instances of %d:\n", str);
	removeString(&ll, str);
	llDisplay(ll);
	printf("Size:  %d\n\n", size(ll));
	
	llAdd(&ll, str);
	llAdd(&ll, str);
	llAdd(&ll, str);
	llAdd(&ll, str4);
	llAdd(&ll, str);
	llAdd(&ll, str6);
	
	printf("LinkedList after repopulation:\n");
	llDisplay(ll);

	llDelete(&ll);
	
	printf("Size:  %d\n", size(ll));
}
Exemple #7
0
int main(void)
{
    void removeString(char text[], int start, int count);
    char text[20] = "the wrong son";
    
    removeString(text, 4, 6);
    
    printf("%s\n", text);
    
}
Exemple #8
0
int main(void)
{
    char s[] = "the wrong son";

    removeString(s, 4, 6);

    printf("%s\n", s);

    return 0;
}
Exemple #9
0
int main (void)
{
    void removeString (char source[], int index, int len);
    char text[] = { "the wrong son" };

    removeString(text, 4, 6);

    printf ("%s\n", text);

    return 0;
}
void FilenameComponent::addRecentlyUsedFile (const File& file)
{
    auto files = getRecentlyUsedFilenames();

    if (file.getFullPathName().isNotEmpty())
    {
        files.removeString (file.getFullPathName(), true);
        files.insert (0, file.getFullPathName());

        setRecentlyUsedFilenames (files);
    }
}
Exemple #11
0
 int main (void)
{
    char source[] = "the wrong son";
	int i = 0;

    printf("Original string: %s \n", source);

    removeString(source, 4, 6);

    printf("Result string: %s \n", source);

    return 0;
}
int main()
{
	void removeString (char phrase[],int start,int count);
	char phrase[] ="raja is the king";
    
    removeString(phrase,5,1);



return 0;


}
bool replaceString(char source[], char s1[], char s2[])
{
	int index = findString(source, s1);
	int s1_len = stringLen(s1);

	if (index == -1)
		return false;

	removeString(source, index, s1_len);

	insertString(source, s2, index);

	return true;
}
Exemple #14
0
void Client::startRead()
{
    //@puts("reading");
    char *buffer = (char*)malloc(sizeof(char)*10240);
    int bytesAvail = client.bytesAvailable();
    client.read(buffer, bytesAvail);
    buffer[bytesAvail] = '\0';
    int bytesPushed=0;
    int *size=(int*)malloc(sizeof(int));
    Action *action = (Action*)malloc(sizeof(int));
    char *msg;

    //loop through the available messages
    while(bytesPushed<bytesAvail){
    *size=0;
    popMetadata(&buffer,action,size,&msg);
    bytesPushed+=(*size+8);
    if(bytesPushed<=bytesAvail){

        //@printf("Bytes pushed: %i, Bytes available: %i\n",bytesPushed,bytesAvail);
        if(bytesPushed<bytesAvail){
            //@printf("Msg: %s\nData remaining: %s\n\n",msg,buffer);
        } else {
            //@printf("Msg: %s\n\n",msg);
        }
        switch(*action) {
            case KEY_EVENT:
                receiveEvent(stringToEvent(msg));
                break;
            case INSERT_STRING:
                insertString(msg);
                break;
            case REMOVE_STRING:
                removeString(msg);
                break;
            case INITIAL_SEND:
                initialRead(msg);
                break;
            case CURSOR_MOVE:
                if(moveRemoteCursor(msg)) cursorPositionChanged();
                break;
            default:
                puts("We don't take your kind here.");
                break;
        }
    } else {
        puts("Well, that went badly.");
    }
    }
}
Exemple #15
0
void ListBox::setItemText(int index, const TCHAR *str)
{
  int si = getSelectedIndex();
  int top = getTopIndex();
  LRESULT lresult = SendMessage(m_hwnd, LB_GETTOPINDEX, NULL, NULL);
  UINT topIndex = (UINT)lresult;
  _ASSERT(topIndex == lresult);
  LPARAM data = getItemData(index);
  removeString(index);
  insertString(index, str, data);
  if (si == index) {
    setSelectedIndex(si);
  }
  setTopIndex(top);
}
Exemple #16
0
int main (void)
{
	char string1[] = "the wrong son";
	char string2[] = "the wrong son";
	char string3[] = "the wrong son";

	printf ("string1: %s\n", string1);
	printf ("string2: %s\n", string2);
	printf ("string3: %s\n\n", string3);

	printf ("removeString (string1, 13, 6)\n");
	removeString (string1, 13, 6);
	printf ("string1: %s\n\n", string1);

	printf ("removeString (string2, 11, 6)\n");
	removeString (string2, 11, 6);
	printf ("string2: %s\n\n", string2);

	printf ("removeString (string3, 4, 6)\n");
	removeString (string3, 4, 6);
	printf ("string3: %s\n\n", string3);

	return 0;
}
bool replaceString (char source [], char find [], char replace []){
    int findString (const char haystack [], const char needle []);
    void removeString(char string [], int start, int length);
    int lengthOf(char source []);
    void insertString (char source [100], char insert [4], int start);
    
    int start = findString(source, find);
    
    if ( start > -1 ){
        removeString (source, start, lengthOf(find));
        insertString (source, replace, start);
        return true;
    }
    
    return false;   // If the string is not found
}
Exemple #18
0
void StolkyListbox::deleted(int stolek) {
  vector<SCStolek *>::iterator vi;
  int i = 1;
  
  for (vi = stoly.begin();
       vi != stoly.end();
       vi++) {
       
    if ((*vi)->id == stolek) {
      break;
    }
    i++;
  }
  if (vi == stoly.end()) return;
  removeString(i);
  stoly.erase(vi);
}
Exemple #19
0
StringListEdit::StringListEdit(const QStringList &list, 
                               UntitledList* unamedList, 
                               QWidget *parent)
    : QDialog(parent), 
      ask(false), 
      duplicatesOk(false),
      _suggestedStringsList(unamedList)
{
    addCaption = "Add String";
    addLabel = "String:";
    editCaption = "Edit String";
    editLabel = addLabel;

    Q3HBoxLayout *hbox = new Q3HBoxLayout(this, 5, 5);
    Q3VBoxLayout *vbox = new Q3VBoxLayout;
    listBox = new Q3ListBox(this);
    connect(listBox, SIGNAL(currentChanged(Q3ListBoxItem*)),
            this, SLOT(updateButtons()));
    hbox->addWidget(listBox, 1);
    QPushButton *button = new QPushButton(tr("&Add..."), this);
    connect(button, SIGNAL(clicked()), this, SLOT(addString()));
    vbox->addWidget(button);
    editButton = new QPushButton(tr("&Edit..."), this);
    connect(editButton, SIGNAL(clicked()), this, SLOT(editString()));
    vbox->addWidget(editButton);
    removeButton = new QPushButton(tr("&Remove..."), this);
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeString()));
    vbox->addWidget(removeButton);
    upButton = new QPushButton(tr("&Up"), this);
    connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    vbox->addWidget(upButton);
    downButton = new QPushButton(tr("&Down"), this);
    connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
    vbox->addWidget(downButton);
    vbox->addStretch(1);
    button = new QPushButton(tr("OK"), this);
    connect(button, SIGNAL(clicked()), this, SLOT(accept()));
    vbox->addWidget(button);
    button = new QPushButton(tr("Cancel"), this);
    connect(button, SIGNAL(clicked()), this, SLOT(reject()));
    vbox->addWidget(button);
    hbox->addLayout(vbox);

    setList(list);
}
Exemple #20
0
int main(void) {
	void removeString(char source[], int start, const int count);
	void readLine(char buffer[]);
	int start, count;
	char source[81];

	printf("Enter source: ");
	readLine(source);

	printf("Enter start and count for removal: ");
	scanf("%i%i", &start, &count);

	removeString(source, start, count);

	printf("The modified string is: %s\n", source);

	return 0;
}
bool replaceString (char text[], const char s1[], const char s2[])
{
    int index = findString (text, s1);

    if ( index >= 0 ) {
        int rm_length = 0;
        while ( s1[rm_length] != '\0' ) {
            ++rm_length;
        }

        removeString (text, index, rm_length);
        insertString (text, s2, index);

        return true;
    } else {
        return false;
    }
}
Exemple #22
0
void Line::analyseLine(Line *previousLine)
{
	bool inMultilineComment = previousLine != NULL ? previousLine->isInMultilineComment() : false;

	std::string multilineTag = inMultilineComment ? "*/" : "/*";
	std::string trimedLine = trim(m_chars);

	if(trimedLine.empty())
	{
		m_type = EMPTY;
		m_isInMultilineComment = inMultilineComment;
		return;
	}

	trimedLine = removeString(trimedLine);

	int tagPosition = inMultilineComment ? trimedLine.size()-2 : 0;
	unsigned int simpleCommentPosition = trimedLine.find("//");
	unsigned int multilineCommentPosition = trimedLine.find(multilineTag);

	if(multilineCommentPosition != trimedLine.npos)
	{
		if(multilineCommentPosition == tagPosition)
			m_type = COMMENT;
		else
			m_type = CODE_AND_COMMENT;
		m_isInMultilineComment = !inMultilineComment;
		return;
	}
	else if(inMultilineComment)
		m_type = COMMENT;
	else if(simpleCommentPosition != trimedLine.npos)
	{
		if(simpleCommentPosition == 0)
			m_type = COMMENT;
		else
			m_type = CODE_AND_COMMENT;
		m_isInMultilineComment = inMultilineComment;
		return;
	}
	else
		m_type = CODE;
	m_isInMultilineComment = inMultilineComment;
}
Exemple #23
0
bool replaceString (char source[], char find[], char replace[])
{
    int stringLength (const char string[]);
    int findString (const char search[], const char find[]);
    void removeString (char source[], int index, int len);
    void insertString (char source[], char insert[], int index);
    
    int index = findString(source, find);
    
    if (index != -1)
    {
        removeString(source, index, stringLength(find));
        insertString(source, replace, index);
        
        return true;
    }
    
    return false;
}
Exemple #24
0
void replaceString(char source[], const char s1[], const char s2[])
{
    int findString(const char s1[], const char s2[]);
    void removeString(char s1[], int start, int counter);
    void insertString(char s1[], const char insert[], int insertNumber);

    int start = findString(source, s1);
    int counter, i = 0;

    while(s1[i] != '\0')
        ++i;

    counter = i;
    while(start != -1)
    {
        removeString(source, start, counter);
        insertString(source, s2, start);
        start = findString(source, s1);
    }
}
void KarplusStrongBattery::setTuning(const std::vector<double> &frequencies) {
    battery_size = frequencies.size();
    for (size_t i = 0; i < battery_size; i++) {
        addString(frequencies[i]);
    }

    for (std::map<double, KSADSRFilter>::iterator iter = battery.begin();
      iter != battery.end(); ++iter) {
          bool found = false;
          for (size_t i = 0; i < frequencies.size(); i++) {
              if (iter->first == frequencies[i]) {
                  found = true;
                  break;
              }
          }
          if (!found) {
              removeString(iter->first);
          }
          if (iter->second.finished()) {
              battery.erase(iter->first);
          }
    }
}
Exemple #26
0
    void Console::addString(const std::string& str)
    {
        history.push_back(str);
        int pos = 2;

        if(!strings.empty()) pos = strings.back().GetPosition().y + 16;
        sf::String tmpStr(history.back(), font, 14.f);
        tmpStr.SetColor(sf::Color::White);
        tmpStr.SetPosition(5, pos);
        strings.push_back(tmpStr);

        if(strings.size() > ((unsigned int) ((panelRect.GetPointPosition(2).y - panelRect.GetPointPosition(0).y) / 17))) removeString();
    }