I have a string where object names are enclosed in <>. Something like this->

```
         String source = 'I have <name> and <id>'; 

```

Object name is stored in another String ->

```
          String objectName = 'Contact'; 

```

I need to get the fields like this->

```
          String fields = 'name,id';    

```

How to achieve this?

So that I can use it in query ->

```
           String query = 'Select '+fields+' from '+objectName;
           List<sObject> myList= Database.Query(query);

```