/*
 * joystick plugin for VDR
 *
 * global.c - global functions
 *
 * Copyright (C) 2003 Andreas Regel <andreas.regel@powarman.de>
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 */

#include <stdlib.h>

#include "global.h"

string trim(string s)
{
	int start;
	int end;
	start = 0;
	while (start < (int) s.length())
	{
		if (!isspace(s[start]))
			break;
		start++;
	}
	end = (int) s.length() - 1;
	while (end >= 0)
	{
		if (!isspace(s[end]))
			break;
		end--;
	}
	return s.substr(start, end - start + 1);
}
